database

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 31, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close()

func CreateIndex

func CreateIndex()

Types

type Alga

type Alga struct {
	field.DefaultField `bson:",inline"`
	Name               string               `json:"name" bson:"name"`
	Src                string               `json:"src" bson:"src"`
	River              primitive.ObjectID   `json:"river" bson:"river"`
	Annotations        []primitive.ObjectID `json:"annotations" bson:"annotations"`
}

type Annotation

type Annotation struct {
	field.DefaultField `bson:",inline"`
	Description        string `json:"description" bson:"description"`
	Format             string `json:"format" bson:"format"`
	Url                string `json:"url" bson:"url"`
}

type Mgo

type Mgo struct{}

func (*Mgo) CheckOperator

func (m *Mgo) CheckOperator(email, password string) (*Operator, error)

func (*Mgo) DropAlga

func (m *Mgo) DropAlga(name string) error

func (*Mgo) DropOperator

func (m *Mgo) DropOperator(email string) error

func (*Mgo) DropRiver

func (m *Mgo) DropRiver(name string) error

func (*Mgo) ExistsOperator

func (m *Mgo) ExistsOperator(email string) bool

func (*Mgo) ExistsRiver

func (m *Mgo) ExistsRiver(name string) bool

func (*Mgo) InsertAlga

func (m *Mgo) InsertAlga(obj *Alga) (interface{}, error)

func (*Mgo) InsertAnnotation

func (m *Mgo) InsertAnnotation(obj *Annotation) (interface{}, error)

func (*Mgo) InsertOperator

func (m *Mgo) InsertOperator(obj *Operator) error

func (*Mgo) InsertRiver

func (m *Mgo) InsertRiver(r *River) error

func (*Mgo) QueryAlgaByKey

func (m *Mgo) QueryAlgaByKey(key string) ([]*Alga, error)

QueryAlgaByKey 正则查找

func (*Mgo) QueryAlgaByName

func (m *Mgo) QueryAlgaByName(name string) (*Alga, error)

QueryAlgaByName 通过名称查找

func (*Mgo) QueryAlgae

func (m *Mgo) QueryAlgae() ([]*Alga, error)

func (*Mgo) QueryAnnotationById

func (m *Mgo) QueryAnnotationById(obj primitive.ObjectID) *Annotation

func (*Mgo) QueryOperatorByEmail

func (m *Mgo) QueryOperatorByEmail(email string) (*Operator, error)

func (*Mgo) QueryOperators

func (m *Mgo) QueryOperators() ([]*Operator, error)

func (*Mgo) QueryRiverById

func (m *Mgo) QueryRiverById(obj primitive.ObjectID) River

func (*Mgo) QueryRiverByName

func (m *Mgo) QueryRiverByName(obj string) River

func (*Mgo) QueryRivers

func (m *Mgo) QueryRivers() ([]*River, error)

func (*Mgo) UpdateAlga

func (m *Mgo) UpdateAlga(id primitive.ObjectID, annotations []primitive.ObjectID) error

func (*Mgo) UpdateOperator

func (m *Mgo) UpdateOperator(id primitive.ObjectID, annotations []primitive.ObjectID) error

func (*Mgo) UpdatePassword

func (m *Mgo) UpdatePassword(email string, newPassword string) error

func (*Mgo) UpdateRiver

func (m *Mgo) UpdateRiver(id primitive.ObjectID, algae []primitive.ObjectID) error

func (*Mgo) UpsertAnnotation

func (m *Mgo) UpsertAnnotation(obj *Annotation) error

func (*Mgo) UpsertOperator

func (m *Mgo) UpsertOperator(email, name, password string, access int) error

type Operator

type Operator struct {
	field.DefaultField `bson:",inline"`
	Name               string               `json:"name" bson:"name"`
	Password           string               `json:"password" bson:"password"`
	Email              string               `json:"email" bson:"email"`
	Access             int                  `json:"access" bson:"access"`
	Annotations        []primitive.ObjectID `json:"annotations" bson:"annotations"`
}

type River

type River struct {
	field.DefaultField `bson:",inline"`
	Name               string               `json:"name" bson:"name"`
	Address            string               `json:"address" bson:"address"`
	Algae              []primitive.ObjectID `json:"algae" bson:"algae"`
}

Jump to

Keyboard shortcuts

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