odm

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2021 License: Apache-2.0 Imports: 11 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDatabase

func GetDatabase() *mongo.Database

Types

type AbstractRepository

type AbstractRepository struct {
	CollectionName string
	Model          reflect.Type
}

func (*AbstractRepository) Find

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

func (*AbstractRepository) FindOne

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

Finds one object based on filters.

func (*AbstractRepository) FindOneById

func (r *AbstractRepository) FindOneById(id string) chan Result

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) Save

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

type DbModel

type DbModel interface {
	Id() string
}

type Result

type Result struct {
	Value interface{}
	Err   error
}

Jump to

Keyboard shortcuts

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