package sample

type Tx interface {
	Commit() error
	Rollback() error
}

type DB interface {
	Begin() (Tx, error)
}

func Save(db DB) error {
	tx, err := db.Begin()
	if err != nil {
		return err
	}
	return tx.Commit()
}