Documentation ¶
Index ¶
- type IMongoDbDatabaseObject
- type IMongoDbRepository
- type MongoDbDatabaseObject
- func (do *MongoDbDatabaseObject) GetCreatedAt() time.Time
- func (do *MongoDbDatabaseObject) GetIsActive() bool
- func (do *MongoDbDatabaseObject) GetUpdatedAt() time.Time
- func (do *MongoDbDatabaseObject) SetCreatedAt(time time.Time)
- func (do *MongoDbDatabaseObject) SetIsActive(isActive bool)
- func (do *MongoDbDatabaseObject) SetUpdatedAt(time time.Time)
- type MongoDbRepository
- func (r *MongoDbRepository[T]) Count(filters interface{}, options *options.CountOptions, collectionName string) (int64, error)
- func (r *MongoDbRepository[T]) Create(entity T, collectionName string) (*T, error)
- func (r *MongoDbRepository[T]) Get(filters interface{}, options *options.FindOneOptions, collectionName string) (*T, error)
- func (r *MongoDbRepository[T]) GetList(filters interface{}, options *options.FindOptions, collectionName string) ([]*T, error)
- func (r *MongoDbRepository[T]) Remove(filters interface{}, collectionName string) error
- func (r *MongoDbRepository[T]) Update(filters interface{}, entity *T, collectionName string) (*T, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IMongoDbDatabaseObject ¶
type IMongoDbRepository ¶
type IMongoDbRepository[T IMongoDbDatabaseObject] interface { Create(entity T, collectionName string) (*T, error) Count(filters interface{}, options *options.CountOptions, collectionName string) (int64, error) Get(filters interface{}, options *options.FindOneOptions, collectionName string) (*T, error) GetList(filters interface{}, options *options.FindOptions, collectionName string) ([]*T, error) Update(filters interface{}, entity *T, collectionName string) (*T, error) Remove(filters interface{}, collectionName string) error }
type MongoDbDatabaseObject ¶
type MongoDbDatabaseObject struct { Section primitive.ObjectID UpdatedAt time.Time CreatedAt time.Time IsActive bool }
func (*MongoDbDatabaseObject) GetCreatedAt ¶
func (do *MongoDbDatabaseObject) GetCreatedAt() time.Time
func (*MongoDbDatabaseObject) GetIsActive ¶
func (do *MongoDbDatabaseObject) GetIsActive() bool
func (*MongoDbDatabaseObject) GetUpdatedAt ¶
func (do *MongoDbDatabaseObject) GetUpdatedAt() time.Time
func (*MongoDbDatabaseObject) SetCreatedAt ¶
func (do *MongoDbDatabaseObject) SetCreatedAt(time time.Time)
func (*MongoDbDatabaseObject) SetIsActive ¶
func (do *MongoDbDatabaseObject) SetIsActive(isActive bool)
func (*MongoDbDatabaseObject) SetUpdatedAt ¶
func (do *MongoDbDatabaseObject) SetUpdatedAt(time time.Time)
type MongoDbRepository ¶
type MongoDbRepository[T IMongoDbDatabaseObject] struct { DatabaseName string // contains filtered or unexported fields }
func NewMongoDbRepository ¶
func NewMongoDbRepository[T IMongoDbDatabaseObject](client *mongo.Client, databaseName string) *MongoDbRepository[T]
func (*MongoDbRepository[T]) Count ¶
func (r *MongoDbRepository[T]) Count(filters interface{}, options *options.CountOptions, collectionName string) (int64, error)
func (*MongoDbRepository[T]) Create ¶
func (r *MongoDbRepository[T]) Create(entity T, collectionName string) (*T, error)
func (*MongoDbRepository[T]) Get ¶
func (r *MongoDbRepository[T]) Get(filters interface{}, options *options.FindOneOptions, collectionName string) (*T, error)
func (*MongoDbRepository[T]) GetList ¶
func (r *MongoDbRepository[T]) GetList(filters interface{}, options *options.FindOptions, collectionName string) ([]*T, error)
func (*MongoDbRepository[T]) Remove ¶
func (r *MongoDbRepository[T]) Remove(filters interface{}, collectionName string) error
func (*MongoDbRepository[T]) Update ¶
func (r *MongoDbRepository[T]) Update(filters interface{}, entity *T, collectionName string) (*T, error)
Click to show internal directories.
Click to hide internal directories.