Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotFound = errors.New("object(s) not found")
ErrNotFound is used when the object(s) was not found
ErrUnavailable is used when the database or collection is unavailable
Functions ¶
This section is empty.
Types ¶
type BasicRepository ¶
type BasicRepository interface { GetByID(ctx context.Context, id objectid.ObjectID, result interface{}) error Find(ctx context.Context, filter interface{}, result interface{}) error FindOne(ctx context.Context, filter interface{}, result interface{}) error UpdateByID(ctx context.Context, id objectid.ObjectID, document interface{}) error Update(ctx context.Context, filter interface{}, document interface{}) error UpsertByID(ctx context.Context, id objectid.ObjectID, document interface{}) error Upsert(ctx context.Context, filter interface{}, document interface{}) error Store(ctx context.Context, document interface{}) (*objectid.ObjectID, error) DeleteByID(ctx context.Context, id objectid.ObjectID) error Delete(ctx context.Context, filter interface{}) error Count(ctx context.Context, filter interface{}) (int64, error) }
BasicRepository is a Repository with common database logic
func NewRepository ¶
func NewRepository(collection Collection) BasicRepository
NewRepository creates a new MongoDB Repository from a MongoDB collection with the BasicRepository type
Click to show internal directories.
Click to hide internal directories.