models

package
v0.0.0-...-c3e71be Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 17, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoRecord godoc
	ErrNoRecord = errors.New("No matching record found")
	// ErrRecordExist godoc
	ErrRecordExist = errors.New("Record already exists")
)

Functions

This section is empty.

Types

type Item

type Item struct {
	ID     int    `json:"id,omitempty" bson:"id,omitempty" datastore:"id"`
	Title  string `json:"title,omitempty" bson:"title,omitempty" datastore:"title"`
	IsDone bool   `json:"isdone,omitempty" bson:"isdone,omitempty" datastore:"isdone"`
}

Item godoc

type ItemModel

type ItemModel struct {
	Repository ItemRepository
}

ItemModel godoc

func (ItemModel) CreateItem

func (model ItemModel) CreateItem(newItem Item) error

CreateItem godoc

func (ItemModel) DeleteItem

func (model ItemModel) DeleteItem(id int) error

DeleteItem godoc

func (ItemModel) GetItem

func (model ItemModel) GetItem(id int) (i Item, e error)

GetItem godoc

func (ItemModel) GetItems

func (model ItemModel) GetItems() (i []Item, e error)

GetItems godoc

func (ItemModel) UpdateItem

func (model ItemModel) UpdateItem(updatedItem Item) error

UpdateItem godoc

type ItemRepository

type ItemRepository interface {
	GetItems() ([]Item, error)
	GetItem(int) (Item, error)
	CreateItem(Item) error
	UpdateItem(Item) error
	DeleteItem(int) error
}

ItemRepository godoc

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL