odm

package
v0.1.12 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2021 License: Apache-2.0 Imports: 12 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetClient added in v0.1.5

func GetClient() *mongo.Client

Types

type AbstractRepository

type AbstractRepository struct {
	Database       string
	CollectionName string
	Model          reflect.Type
}

func (*AbstractRepository) DeleteById added in v0.1.9

func (r *AbstractRepository) DeleteById(id string) chan error

func (*AbstractRepository) DeleteOne added in v0.1.9

func (r *AbstractRepository) DeleteOne(filters bson.M) chan error

func (*AbstractRepository) Find

func (r *AbstractRepository) Find(filters bson.M, sort bson.D, limit, skip int64) chan util.AsyncResult

func (*AbstractRepository) FindOne

func (r *AbstractRepository) FindOne(filters bson.M) chan util.AsyncResult

Finds one object based on filters.

func (*AbstractRepository) FindOneById

func (r *AbstractRepository) FindOneById(id string) chan util.AsyncResult

Finds one object based on Id.

func (*AbstractRepository) GetModel

func (r *AbstractRepository) GetModel(proto interface{}) interface{}

Gets an instance of model from proto or othe object.

func (*AbstractRepository) IsExistsById added in v0.1.7

func (r *AbstractRepository) IsExistsById(id string) bool

checks if a record exists by id. Synchronous becuase it is expected to be very light-weighted without deserialization etc.

func (*AbstractRepository) Save

func (r *AbstractRepository) Save(model DbModel) chan error

type DbModel

type DbModel interface {
	Id() string
}

Jump to

Keyboard shortcuts

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