gomongo

package module
v0.0.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 24, 2024 License: MIT Imports: 8 Imported by: 2

Documentation

Index

Constants

View Source
const NotFoundDocumentError = "mongo: no documents in result"

Variables

This section is empty.

Functions

func ConnectToMongo

func ConnectToMongo(uri string) *mongo.Client

func InTransactionSession

func InTransactionSession(Client *mongo.Client, ctx context.Context, f func(sc mongo.SessionContext) error)

func Int64Ptr

func Int64Ptr(v *int) *int64

func LocationParametersToMongoQuery

func LocationParametersToMongoQuery(parameters *location.LocationParameters) bson.M

func ObjIdListToStrList

func ObjIdListToStrList(list []primitive.ObjectID) []string

func ObjIdToStr

func ObjIdToStr(id *primitive.ObjectID) *string

func StrListToObjIdList

func StrListToObjIdList(list []string) []primitive.ObjectID

func StrToObjId

func StrToObjId(id *string) *primitive.ObjectID

Types

type BaseMongoRepository

type BaseMongoRepository struct {
	// contains filtered or unexported fields
}

func NewBaseMongoRepository added in v0.0.2

func NewBaseMongoRepository(database *mongo.Database, collectionName string) *BaseMongoRepository

func (*BaseMongoRepository) Collection

func (m *BaseMongoRepository) Collection() *mongo.Collection

func (*BaseMongoRepository) DeleteOne

func (m *BaseMongoRepository) DeleteOne(ctx context.Context, q bson.M) bool

func (*BaseMongoRepository) GetList

func (m *BaseMongoRepository) GetList(ctx context.Context, result interface{}, q bson.M, skip, limit *int, sort *bson.D) int

func (*BaseMongoRepository) InsertOne

func (m *BaseMongoRepository) InsertOne(ctx context.Context, newValue interface{}) primitive.ObjectID

func (*BaseMongoRepository) UpdateOne

func (m *BaseMongoRepository) UpdateOne(ctx context.Context, q bson.M, update bson.M) bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL