database

package
v0.0.0-...-fc1953b Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2018 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ARTIDS_COL     = "artIds"
	ALERTS_COL     = "alerts" // unused... Will be used with @AlertItem
	EXPRESSION_COL = "exps"
	CATEGORY_COL   = "cats"
	UPLOADS_COL    = "uploads"
	USERS_COL      = "users"
)

Variables

View Source
var MongoInstance *mongo

Functions

func NewMongo

func NewMongo()

Types

type AlertItem

type AlertItem struct {
	MGID  bson.ObjectId `json:"-" bson:"_id,omitempty"`
	Key   string        `json:"key"`
	Value string        `json:"message"`
	TTL   float64       `json:"ttl"` // Time To Live
}

type ArtItem

type ArtItem struct {
	MGID        bson.ObjectId `json:"-" bson:"_id,omitempty"`
	Folder      string        `json:"folder"`
	FileName    string        `json:"filename"`
	OrgFileName string        `json:"orgfilename"`
	Uploaded    time.Time     `json:"uploaded_on"`
	FileSize    int           `json:"file_size"`
	Width       int           `json:"width"`
	Height      int           `json:"height"`
}

type CategoryItem

type CategoryItem struct {
	MGID bson.ObjectId `json:"-" bson:"_id,omitempty"`
	Name string        `json:"name"`
}

type ExpressionItem

type ExpressionItem struct {
	MGID          bson.ObjectId   `json:"-" bson:"_id,omitempty"`
	Expression    string          `json:"expression"`
	ExpressionCmp string          `json:"-" bson:"cid"`
	Usage         int             `json:"count"`
	CatIDs        []bson.ObjectId `json:"-" bson:"cats"` //enfoce using the bson object because this shit can fail...
}

type Upload

type Upload struct {
	MGID        bson.ObjectId   `json:"-" bson:"_id,omitempty"`
	ImageID     bson.ObjectId   `json:"-" bson:"img_id`
	Expressions []bson.ObjectId `json:"expressions" bson:"exps"` // set if multiable are used (will always be 0 if empty)
	Tags        []bson.ObjectId `json:"tags"`
	User        bson.ObjectId   `json:"user" bson:"user,omitempty"`
	Views       int             `json:"views"`
}

type User

type User struct {
	MGID      bson.ObjectId `json:"id" bson:"_id,omitempty"`
	Email     string        `json:"email"`
	Username  string        `json:"username"`
	Password  string        `json:"-"`
	Updated   time.Time     `json:"-"`
	Joined    time.Time     `json:"-"`
	LastLogin time.Time     `json:"-" bson:"ll"` // unused for now
}

Jump to

Keyboard shortcuts

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