Documentation ¶
Index ¶
- func Create(ctx context.Context, c *mongo.Collection, e Entity) error
- func Delete(ctx context.Context, c *mongo.Collection, e Entity) error
- func DeleteAll(ctx context.Context, c *mongo.Collection, q Query) (int64, error)
- func EnsureIndexes(ctx context.Context, c *mongo.Collection, ks ...string) error
- func Get(ctx context.Context, c *mongo.Collection, q Query, i interface{}) error
- func GetAll(ctx context.Context, c *mongo.Collection, p Pipeline, e EntityArray) error
- type BasicCriteria
- type BasicEntity
- type Criteria
- type Entity
- type EntityArray
- type Pipeline
- type Query
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnsureIndexes ¶
EnsureIndexes create custom and default indexes.
func GetAll ¶
func GetAll(ctx context.Context, c *mongo.Collection, p Pipeline, e EntityArray) error
GetAll populates entity array with results of given pipeline.
Types ¶
type BasicCriteria ¶
type BasicCriteria struct {
// contains filtered or unexported fields
}
BasicCriteria for documents.
func (*BasicCriteria) AppendQuery ¶
func (b *BasicCriteria) AppendQuery(q Query)
AppendQuery add a new query to the list.
func (*BasicCriteria) ID ¶
func (b *BasicCriteria) ID(ids ...objectid.ObjectID) *BasicCriteria
ID appender for basic criteria.
func (*BasicCriteria) UUID ¶
func (b *BasicCriteria) UUID(uuids ...string) *BasicCriteria
UUID appender for basic criteria.
type BasicEntity ¶
type BasicEntity struct { ID objectid.ObjectID `bson:"_id" json:"-"` UUID string `bson:"uuid" json:"uuid"` CreationDate *time.Time `bson:"creation_date,omitempty" json:"creation_date"` UpdateDate *time.Time `bson:"update_date,omitempty" json:"update_date"` }
BasicEntity struct contains fields for documents.
func (*BasicEntity) GenerateIDs ¶
func (b *BasicEntity) GenerateIDs()
GenerateIDs create values for ID and UUID.
func (BasicEntity) GetID ¶
func (b BasicEntity) GetID() objectid.ObjectID
GetID returns ID for basic entity.
func (BasicEntity) GetUUID ¶
func (b BasicEntity) GetUUID() string
GetUUID returns UUID for basic entity.
Click to show internal directories.
Click to hide internal directories.