Documentation ¶
Index ¶
- type CrudService
- func (cs *CrudService) Add(ctx context.Context, book model.Book) (model.Book, error)
- func (m *CrudService) Close(ctx context.Context) error
- func (cs *CrudService) Get(ctx context.Context, id string) (model.Book, error)
- func (cs *CrudService) List(ctx context.Context, limit int) ([]model.Book, error)
- func (m *CrudService) Ping(ctx context.Context) error
- func (cs *CrudService) Remove(ctx context.Context, id string) (model.Book, error)
- func (cs *CrudService) Update(ctx context.Context, id string, book model.Book) (model.Book, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CrudService ¶
type CrudService struct {
// contains filtered or unexported fields
}
CrudService stores Book instances in a MongoDB collection.
func NewCrudService ¶
func NewCrudService(mongoURI, database, collection string) (*CrudService, error)
NewCrudService creates a new CRUD service for MongoDB.
Click to show internal directories.
Click to hide internal directories.