Documentation ¶
Index ¶
- Variables
- type DocumentBase
- type IEntity
- type PaginationInfo
- type Query
- type Repository
- func (r *Repository) Count(query bson.M) (int, error)
- func (r *Repository) Delete(doc IEntity) error
- func (r *Repository) Find(query bson.M) (*Query, error)
- func (r *Repository) FindOne(query bson.M, doc IEntity) error
- func (r *Repository) GetByID(ID bson.ObjectId, doc IEntity) error
- func (r *Repository) Paginate(query bson.M, recordsPerPage, page int) (*Query, *PaginationInfo, error)
- func (r *Repository) Save(doc IEntity) error
Constants ¶
This section is empty.
Variables ¶
View Source
var MongodbURI string
Functions ¶
This section is empty.
Types ¶
type DocumentBase ¶
DocumentBase implements all the methods to the IEntity interface
func (*DocumentBase) GetID ¶
func (doc *DocumentBase) GetID() bson.ObjectId
GetID returns the id of the document
func (*DocumentBase) SetID ¶
func (doc *DocumentBase) SetID(ID bson.ObjectId)
SetID sets the ID field of the document
type IEntity ¶
IEntity defines all the methods to be used on the documents when saved and queried on the db
type PaginationInfo ¶
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
func NewRepository ¶
func NewRepository(database, collection string) *Repository
func (*Repository) Delete ¶
func (r *Repository) Delete(doc IEntity) error
func (*Repository) Paginate ¶
func (r *Repository) Paginate(query bson.M, recordsPerPage, page int) (*Query, *PaginationInfo, error)
func (*Repository) Save ¶
func (r *Repository) Save(doc IEntity) error
Click to show internal directories.
Click to hide internal directories.