Documentation ¶
Index ¶
- func GetClient() *mongo.Client
- type AbstractRepository
- func (r *AbstractRepository[T]) DeleteById(id string) chan error
- func (r *AbstractRepository[T]) DeleteOne(filters bson.M) chan error
- func (r *AbstractRepository[T]) Find(filters bson.M, sort bson.D, limit, skip int64) (chan []T, chan error)
- func (r *AbstractRepository[T]) FindOne(filters bson.M) (chan *T, chan error)
- func (r *AbstractRepository[T]) FindOneById(id string) (chan *T, chan error)
- func (r *AbstractRepository[T]) GetModel(proto interface{}) *T
- func (r *AbstractRepository[T]) IsExistsById(id string) bool
- func (r *AbstractRepository[T]) Save(model DbModel) chan error
- type DbModel
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AbstractRepository ¶
func (*AbstractRepository[T]) DeleteById ¶ added in v0.1.9
func (r *AbstractRepository[T]) DeleteById(id string) chan error
func (*AbstractRepository[T]) DeleteOne ¶ added in v0.1.9
func (r *AbstractRepository[T]) DeleteOne(filters bson.M) chan error
func (*AbstractRepository[T]) FindOne ¶
func (r *AbstractRepository[T]) FindOne(filters bson.M) (chan *T, chan error)
Finds one object based on filters.
func (*AbstractRepository[T]) FindOneById ¶
func (r *AbstractRepository[T]) FindOneById(id string) (chan *T, chan error)
Finds one object based on Id.
func (*AbstractRepository[T]) GetModel ¶
func (r *AbstractRepository[T]) GetModel(proto interface{}) *T
Gets an instance of model from proto or othe object.
func (*AbstractRepository[T]) IsExistsById ¶ added in v0.1.7
func (r *AbstractRepository[T]) IsExistsById(id string) bool
checks if a record exists by id. Synchronous becuase it is expected to be very light-weighted without deserialization etc.
func (*AbstractRepository[T]) Save ¶
func (r *AbstractRepository[T]) Save(model DbModel) chan error
Click to show internal directories.
Click to hide internal directories.