models

package
v0.0.0-...-0b86ddf Latest Latest
Warning

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

Go to latest
Published: May 12, 2017 License: MIT Imports: 6 Imported by: 16

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppAccess

type AppAccess struct {
	Token    string    `bson:"Token" json:"Token"`
	TOC      time.Time `bson:"TOC" json:"TOC"`
	TTL      int64     `bson:"TTL" json:"TTL"`
	RoleName string    `bson:"RoleName" json:"RoleName"`
	Paths    []AppPath `bson:"Paths" json:"Paths"`
}

type AppPath

type AppPath struct {
	Path        string `bson:"Path" json:"Path"`
	AccessLevel int8   `bson:"AccessLevel" json:"AccessLevel"`
}

type User

type User struct {
	Id       bson.ObjectId `bson:"_id,omitempty" json:"Id"`
	Username string        `bson:"Username" json:"Username"`
	Password string        `bson:"Password" json:"Password"`
	Email    string        `bson:"Email" json:"Email"`
	Name     string        `bson:"Name" json:"Name"`
	TOC      time.Time     `bson:"TOC" json:"TOC"`
	TTL      int64         `bson:"TTL" json:"TTL"`
	Accesses []AppAccess   `bson:"AppAccess" json:"AppAccess"`
	IsActive bool          `bson:"IsActive" json:"IsActive"`
}

func (User) DbFetchOne

func (this User) DbFetchOne(q *mgo.Query) (interface{}, error)

func (User) DbInsertOne

func (this User) DbInsertOne(uc *mgo.Collection) (uu interface{}, er error)

func (User) DbReplaceOne

func (this User) DbReplaceOne(uc *mgo.Collection) (uu interface{}, er error)

func (User) DbUpdateOne

func (this User) DbUpdateOne(uc *mgo.Collection, sel bson.M, updates bson.M) (uu interface{}, er error)

func (User) IsAuth

func (this User) IsAuth(AppToken string, accessLevel int8, url string) (User, error)

This function is used to check for authorization of the user to access specific url if allowed it returns success else returns the reason of error

func (User) IsLogin

func (this User) IsLogin(self *User, result *bool) error

This function is used for login api calls.

type Users

type Users []User

func (Users) DbFetchAll

func (this Users) DbFetchAll(q *mgo.Query) (interface{}, error)

func (Users) DbInsertAll

func (this Users) DbInsertAll(uc *mgo.Collection) (uu interface{}, er error)

func (Users) DbReplaceAll

func (this Users) DbReplaceAll(uc *mgo.Collection) (uu interface{}, er error)

func (Users) DbUpdateAll

func (this Users) DbUpdateAll(uc *mgo.Collection, sel bson.M, updates bson.M) (uu interface{}, er error)

Jump to

Keyboard shortcuts

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