rMongo

package
v0.1.55 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2025 License: MIT Imports: 17 Imported by: 0

README

sMongo

Default dir:

.env/mongodb/

Make a file with this format on default dir:

Write.yaml

environment: write username: devWrite password: devWritePass host: mongo_db port: 27017 auth_database: admin

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoDocuments = mongo.ErrNoDocuments
)

Functions

func BsonUnmarshal added in v0.1.48

func BsonUnmarshal(m M, val interface{}) error

func CreateMany

func CreateMany[T []InterModel](inters T, coll InterRepo) error

CreateMany

func CreateManyWithCtx added in v0.1.45

func CreateManyWithCtx[T []InterModel](ctx context.Context, inters T, coll InterRepo) error

func FilterFields added in v0.1.39

func FilterFields(inter rFilter.Inter) (bson.D, error)

func GetID

func GetID(id interface{}) primitive.ObjectID

func GetInterID added in v0.1.48

func GetInterID(id interface{}) rFilter.InterID

func NewFilter

func NewFilter() *rFilter.Filters

func NewPipeline

func NewPipeline() pipeline.Inter

func NewSort

func NewSort() *rSort.Sorts

func SortFields added in v0.1.39

func SortFields(inter rSort.Inter) (bson.D, error)

Types

type A added in v0.1.49

type A = bson.A

type D added in v0.1.49

type D = bson.D

type DateFields added in v0.1.48

type DateFields struct {
	mgm.DateFields `bson:",inline"`
}

func (*DateFields) CreatedAt added in v0.1.48

func (m *DateFields) CreatedAt() time.Time

func (*DateFields) UpdatedAt added in v0.1.48

func (m *DateFields) UpdatedAt() time.Time

type GetRepoFunc added in v0.1.55

type GetRepoFunc func(ctx context.Context, env, conn_name, db_name, coll_name string,
	indexes ...rIndex.Inter) (collection.Inter, error)

type Inter

type Inter interface {
	Log()

	SetDebug(bool)

	GetColl(ctx context.Context, env, conn_name, db_name, coll_name string,
		indexes ...rIndex.Inter) (collection.Inter, error)
}

func New

func New() Inter

type InterAdmin added in v0.1.47

type InterAdmin interface {
	Inter

	GetClient(env, conn_name string) (*client.Base, error)
}

func NewAdmin added in v0.1.47

func NewAdmin() InterAdmin

type InterAdminClient added in v0.1.47

type InterAdminClient interface {
	client.InterAdmin
}

type InterAdminDatabase added in v0.1.47

type InterAdminDatabase interface {
	database.InterAdmin
}

type InterDate

type InterDate interface {
	mgm.Date

	CreatedAt() time.Time
	UpdatedAt() time.Time
}

type InterModel

type InterModel interface {
	mgm.Model

	ID() ObjectID
}

type InterModelDate

type InterModelDate interface {
	InterModel
	InterDate
}

type InterModelDateState

type InterModelDateState interface {
	InterModel
	InterDate
	InterState
}

type InterModelState

type InterModelState interface {
	InterModel
	InterState
}

type InterRepo added in v0.1.47

type InterRepo interface {
	collection.Inter
}

type InterState

type InterState interface {
	mgm.State
}

type M added in v0.1.48

type M = bson.M

Alias bson

func BsonMarshal added in v0.1.48

func BsonMarshal(val interface{}) (M, error)

type Model added in v0.1.47

type Model struct {
	mgm.DefaultModel `bson:",inline"`
}

func (*Model) ID added in v0.1.47

func (m *Model) ID() ObjectID

type ModelDate added in v0.1.47

type ModelDate struct {
	Model      `bson:",inline"`
	DateFields `bson:",inline"`
}

type ModelDateState added in v0.1.47

type ModelDateState struct {
	Model           `bson:",inline"`
	DateFields      `bson:",inline"`
	mgm.StateFields `bson:",inline"`
}

type ModelState added in v0.1.47

type ModelState struct {
	Model          `bson:",inline"`
	mgm.StateField `bson:",inline"`
}

type ObjectID added in v0.1.29

type ObjectID = primitive.ObjectID

Alias ObjectID

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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