Documentation ¶
Index ¶
- type MongoRepository
- func (r *MongoRepository[T]) AggregateMultiple(ctx context.Context, pipeline []bson.M) ([]bson.M, error)
- func (r *MongoRepository[T]) AggregateOne(ctx context.Context, pipeline []bson.M) (bson.M, error)
- func (r *MongoRepository[T]) Count(query *QueryBuilder[T]) (int64, error)
- func (r *MongoRepository[T]) CountAll() (int64, error)
- func (r *MongoRepository[T]) Delete(query *QueryBuilder[T]) (int64, error)
- func (r *MongoRepository[T]) DeleteById(id primitive.ObjectID) error
- func (r *MongoRepository[T]) ExistsById(id primitive.ObjectID) (bool, error)
- func (r *MongoRepository[T]) FindAll() ([]T, error)
- func (r *MongoRepository[T]) FindById(id primitive.ObjectID) (T, error)
- func (r *MongoRepository[T]) FindByIds(ids []primitive.ObjectID) ([]T, error)
- func (r *MongoRepository[T]) QueryMany(query *QueryBuilder[T]) ([]T, error)
- func (r *MongoRepository[T]) QueryOne(query *QueryBuilder[T]) (T, error)
- func (r *MongoRepository[T]) QueryRunner() *QueryBuilder[T]
- func (r *MongoRepository[T]) Save(item T) (T, error)
- func (r *MongoRepository[T]) SaveAll(items []T) ([]T, error)
- type QueryBuilder
- func (q *QueryBuilder[T]) Context(ctx context.Context) *QueryBuilder[T]
- func (q *QueryBuilder[T]) Count() (int64, error)
- func (q *QueryBuilder[T]) Delete() (int64, error)
- func (q *QueryBuilder[T]) Filter(filter string, params ...interface{}) *QueryBuilder[T]
- func (q *QueryBuilder[T]) FilterB(filter bson.M) *QueryBuilder[T]
- func (q *QueryBuilder[T]) Pageable(pageable [2]int) *QueryBuilder[T]
- func (q *QueryBuilder[T]) Projection(projection string) *QueryBuilder[T]
- func (q *QueryBuilder[T]) ProjectionB(projection bson.M) *QueryBuilder[T]
- func (q *QueryBuilder[T]) QueryMany() ([]T, error)
- func (q *QueryBuilder[T]) QueryOne() (T, error)
- func (q *QueryBuilder[T]) Sort(sort string) *QueryBuilder[T]
- func (q *QueryBuilder[T]) SortB(sort bson.D) *QueryBuilder[T]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MongoRepository ¶
type MongoRepository[T any] struct { // contains filtered or unexported fields }
func NewMongoRepository ¶
func NewMongoRepository[T any](collection *mongo.Collection) (*MongoRepository[T], error)
func (*MongoRepository[T]) AggregateMultiple ¶
func (*MongoRepository[T]) AggregateOne ¶
func (*MongoRepository[T]) Count ¶
func (r *MongoRepository[T]) Count(query *QueryBuilder[T]) (int64, error)
func (*MongoRepository[T]) CountAll ¶
func (r *MongoRepository[T]) CountAll() (int64, error)
func (*MongoRepository[T]) Delete ¶
func (r *MongoRepository[T]) Delete(query *QueryBuilder[T]) (int64, error)
func (*MongoRepository[T]) DeleteById ¶
func (r *MongoRepository[T]) DeleteById(id primitive.ObjectID) error
func (*MongoRepository[T]) ExistsById ¶
func (r *MongoRepository[T]) ExistsById(id primitive.ObjectID) (bool, error)
func (*MongoRepository[T]) FindAll ¶
func (r *MongoRepository[T]) FindAll() ([]T, error)
func (*MongoRepository[T]) FindById ¶
func (r *MongoRepository[T]) FindById(id primitive.ObjectID) (T, error)
func (*MongoRepository[T]) FindByIds ¶
func (r *MongoRepository[T]) FindByIds(ids []primitive.ObjectID) ([]T, error)
func (*MongoRepository[T]) QueryMany ¶
func (r *MongoRepository[T]) QueryMany(query *QueryBuilder[T]) ([]T, error)
func (*MongoRepository[T]) QueryOne ¶
func (r *MongoRepository[T]) QueryOne(query *QueryBuilder[T]) (T, error)
func (*MongoRepository[T]) QueryRunner ¶
func (r *MongoRepository[T]) QueryRunner() *QueryBuilder[T]
func (*MongoRepository[T]) Save ¶
func (r *MongoRepository[T]) Save(item T) (T, error)
func (*MongoRepository[T]) SaveAll ¶
func (r *MongoRepository[T]) SaveAll(items []T) ([]T, error)
type QueryBuilder ¶
type QueryBuilder[T any] struct { // contains filtered or unexported fields }
func (*QueryBuilder[T]) Context ¶
func (q *QueryBuilder[T]) Context(ctx context.Context) *QueryBuilder[T]
func (*QueryBuilder[T]) Count ¶
func (q *QueryBuilder[T]) Count() (int64, error)
func (*QueryBuilder[T]) Delete ¶
func (q *QueryBuilder[T]) Delete() (int64, error)
func (*QueryBuilder[T]) Filter ¶
func (q *QueryBuilder[T]) Filter(filter string, params ...interface{}) *QueryBuilder[T]
func (*QueryBuilder[T]) FilterB ¶
func (q *QueryBuilder[T]) FilterB(filter bson.M) *QueryBuilder[T]
func (*QueryBuilder[T]) Pageable ¶
func (q *QueryBuilder[T]) Pageable(pageable [2]int) *QueryBuilder[T]
func (*QueryBuilder[T]) Projection ¶
func (q *QueryBuilder[T]) Projection(projection string) *QueryBuilder[T]
func (*QueryBuilder[T]) ProjectionB ¶
func (q *QueryBuilder[T]) ProjectionB(projection bson.M) *QueryBuilder[T]
func (*QueryBuilder[T]) QueryMany ¶
func (q *QueryBuilder[T]) QueryMany() ([]T, error)
func (*QueryBuilder[T]) QueryOne ¶
func (q *QueryBuilder[T]) QueryOne() (T, error)
func (*QueryBuilder[T]) Sort ¶
func (q *QueryBuilder[T]) Sort(sort string) *QueryBuilder[T]
func (*QueryBuilder[T]) SortB ¶
func (q *QueryBuilder[T]) SortB(sort bson.D) *QueryBuilder[T]
Click to show internal directories.
Click to hide internal directories.