Documentation
¶
Index ¶
- func FormatLimitOffset(limit, offset int) string
- func NewSessionStore(db *DB) *postgresstore.PostgresStore
- type DB
- type ItemListService
- func (svc *ItemListService) CreateItem(ctx context.Context, item *todo.Item) error
- func (svc *ItemListService) CreateList(ctx context.Context, list *todo.List) error
- func (svc *ItemListService) DeleteItem(ctx context.Context, id int) error
- func (svc *ItemListService) DeleteList(ctx context.Context, id int) error
- func (svc *ItemListService) FindItemByID(ctx context.Context, id int) (*todo.Item, error)
- func (svc *ItemListService) FindItems(ctx context.Context, f todo.ItemFilter) ([]*todo.Item, error)
- func (svc *ItemListService) FindListByID(ctx context.Context, id int) (*todo.List, error)
- func (svc *ItemListService) FindLists(ctx context.Context, f todo.ListFilter) ([]*todo.List, error)
- func (svc *ItemListService) UpdateItem(ctx context.Context, id int, upd todo.ItemUpdate) (*todo.Item, error)
- func (svc *ItemListService) UpdateList(ctx context.Context, id int, upd todo.ListUpdate) (*todo.List, error)
- type Logger
- type Time
- type Tx
- type UserService
- func (svc *UserService) CreateUser(ctx context.Context, user *todo.User) error
- func (svc *UserService) DeleteUser(ctx context.Context, id int) error
- func (svc *UserService) FindUserByAPIKey(ctx context.Context, apiKey string) (*todo.User, error)
- func (svc *UserService) FindUserByID(ctx context.Context, id int) (*todo.User, error)
- func (svc *UserService) FindUserByName(ctx context.Context, name string) (*todo.User, error)
- func (svc *UserService) FindUsers(ctx context.Context, f todo.UserFilter) ([]*todo.User, error)
- func (svc *UserService) LoginUser(ctx context.Context, user *todo.User) error
- func (svc *UserService) UpdateUser(ctx context.Context, id int, upd todo.UserUpdate) (*todo.User, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatLimitOffset ¶
FormatLimitOffset returns a LIMIT/OFFSET clause or an empty string if none is specified.
func NewSessionStore ¶
func NewSessionStore(db *DB) *postgresstore.PostgresStore
Types ¶
type DB ¶
type DB struct { // Connection string DSN string // Application logger Logger todo.Logger // EnableQueryLogging toggles INFO logging of underlying SQL queries. EnableQueryLogging bool // Now returns current time in UTC rounded to the nearest microsecond Now func() time.Time // contains filtered or unexported fields }
DB is a database driver wrapper which exposes utility methods for interacting with Postgres.
type ItemListService ¶
type ItemListService struct {
// contains filtered or unexported fields
}
func NewItemListService ¶
func NewItemListService(db *DB) *ItemListService
func (*ItemListService) CreateItem ¶
func (*ItemListService) CreateList ¶
func (*ItemListService) DeleteItem ¶
func (svc *ItemListService) DeleteItem(ctx context.Context, id int) error
func (*ItemListService) DeleteList ¶
func (svc *ItemListService) DeleteList(ctx context.Context, id int) error
func (*ItemListService) FindItemByID ¶
func (*ItemListService) FindItems ¶
func (svc *ItemListService) FindItems(ctx context.Context, f todo.ItemFilter) ([]*todo.Item, error)
func (*ItemListService) FindListByID ¶
func (*ItemListService) FindLists ¶
func (svc *ItemListService) FindLists(ctx context.Context, f todo.ListFilter) ([]*todo.List, error)
func (*ItemListService) UpdateItem ¶
func (svc *ItemListService) UpdateItem(ctx context.Context, id int, upd todo.ItemUpdate) (*todo.Item, error)
func (*ItemListService) UpdateList ¶
func (svc *ItemListService) UpdateList(ctx context.Context, id int, upd todo.ListUpdate) (*todo.List, error)
type Time ¶
Time is a helper type used on time.Time to ensure that records read/written to postgres are properly formatted and in UTC time rounded to the nearest microsecond.
type UserService ¶
type UserService struct {
// contains filtered or unexported fields
}
func NewUserService ¶
func NewUserService(db *DB) *UserService
func (*UserService) CreateUser ¶
func (*UserService) DeleteUser ¶
func (svc *UserService) DeleteUser(ctx context.Context, id int) error
func (*UserService) FindUserByAPIKey ¶
func (*UserService) FindUserByID ¶
func (*UserService) FindUserByName ¶
func (*UserService) FindUsers ¶
func (svc *UserService) FindUsers(ctx context.Context, f todo.UserFilter) ([]*todo.User, error)
func (*UserService) UpdateUser ¶
func (svc *UserService) UpdateUser(ctx context.Context, id int, upd todo.UserUpdate) (*todo.User, error)
Click to show internal directories.
Click to hide internal directories.