Documentation ¶
Index ¶
- type IMongoRepository
- type MongoRepository
- func (r MongoRepository[T]) All() (*[]T, error)
- func (r MongoRepository[T]) Create(item T) (*mongo.InsertOneResult, error)
- func (r MongoRepository[T]) Delete(id primitive.ObjectID) (*mongo.DeleteResult, error)
- func (r MongoRepository[T]) Find(filter bson.D) (*[]T, error)
- func (r MongoRepository[T]) FindOne(filter bson.D) (*T, error)
- func (r MongoRepository[T]) Get(id primitive.ObjectID) (*T, error)
- func (r MongoRepository[T]) Update(id primitive.ObjectID, item T) (*mongo.UpdateResult, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IMongoRepository ¶
type IMongoRepository[T any] interface { All() (*[]T, error) Find(filter bson.D) (*[]T, error) FindOne(filter bson.D) (*T, error) Get(id primitive.ObjectID) (*T, error) Create(item T) (*mongo.InsertOneResult, error) Update(id primitive.ObjectID, item T) (*mongo.UpdateResult, error) Delete(id primitive.ObjectID) (*mongo.DeleteResult, error) }
type MongoRepository ¶
type MongoRepository[T any] struct { Collection *mongo.Collection }
func (MongoRepository[T]) All ¶
func (r MongoRepository[T]) All() (*[]T, error)
func (MongoRepository[T]) Create ¶
func (r MongoRepository[T]) Create(item T) (*mongo.InsertOneResult, error)
func (MongoRepository[T]) Delete ¶
func (r MongoRepository[T]) Delete(id primitive.ObjectID) (*mongo.DeleteResult, error)
func (MongoRepository[T]) Update ¶
func (r MongoRepository[T]) Update(id primitive.ObjectID, item T) (*mongo.UpdateResult, error)
Click to show internal directories.
Click to hide internal directories.