db

package
v0.0.0-...-a51df50 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2019 License: MPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteSession

func DeleteSession(key string, database *DB)

func Hash

func Hash(data string) string

func NewSession

func NewSession(userID string, database *DB) *http.Cookie

Types

type DB

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

func OpenDB

func OpenDB(url string) DB

func (*DB) CloseDB

func (db *DB) CloseDB()

func (*DB) DeleteAll

func (db *DB) DeleteAll(collection string, document interface{})

func (*DB) DeleteOne

func (db *DB) DeleteOne(collection string, ObjID primitive.ObjectID)

func (*DB) FindAll

func (db *DB) FindAll(query bson.D, collectionname string) []primitive.D

func (*DB) FindOne

func (db *DB) FindOne(query bson.D, colletionname string) interface{}

func (*DB) InsertOne

func (db *DB) InsertOne(collention string, document interface{}) bool

func (*DB) UpdateOne

func (db *DB) UpdateOne(collection string, document interface{}, ObjID primitive.ObjectID) bool

type Session

type Session struct {
	ObjID   primitive.ObjectID `json:"id" bson:"_id,omitempty"`
	USER_ID string             `bson:"USERID"`
	KEY     string             `bson:"KEY"`
	EXPIRES int64              `bson:"EXPIRES"`
}

func GetSession

func GetSession(key string, database *DB) Session

type User

type User struct {
	ObjID   primitive.ObjectID `json:"id" bson:"_id,omitempty"`
	NAME    string             `bson:"NAME"`
	PASSWD  string             `bson:"PASSWD"`
	ID      string             `bson:"ID"`
	EMAIL   string             `bson:"EMAIL"`
	YubiKey string             `bson:"YubiKey"`
	ADMIN   bool               `bson:"ADMIN"`
}

Jump to

Keyboard shortcuts

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