models

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Destroy

func Destroy()

func GetSession

func GetSession() *mgo.Session

func GlobalSession

func GlobalSession() *mgo.Session

func NewMongodbColl

func NewMongodbColl(dbName, collName string) *mgo.Collection

func NewMongodbDB

func NewMongodbDB(dbName string) *mgo.Database

Types

type MongoDB

type MongoDB struct {
	Session *mgo.Session
}

type MongoInfo

type MongoInfo struct {
	Addrs     string
	Timeout   int64
	PoolLimit int
}

type Permission

type Permission struct {
	Id         bson.ObjectId `bson:"_id,omitempty" json:"id"`
	Name       string        `bson:"name" json:"name"`
	Descrip    string        `bson:"descrip" json:"descrip"`
	Sep        string        `bson:"sep" json:"sep"`
	CreateTime time.Time     `bson:"createTime" json:"createTime"`
	UpdateTime time.Time     `bson:"updateTime,omitempty" json:"updateTime"`
}

func (Permission) GetCreateTime added in v1.0.1

func (p Permission) GetCreateTime() time.Time

func (Permission) GetDescrip added in v1.0.1

func (p Permission) GetDescrip() string

func (Permission) GetName added in v1.0.1

func (p Permission) GetName() string

func (Permission) GetSep added in v1.0.1

func (p Permission) GetSep() string

func (Permission) GetUpdateTime added in v1.0.1

func (p Permission) GetUpdateTime() time.Time

func (Permission) Getid added in v1.0.1

func (p Permission) Getid() string

type PermissionColl

type PermissionColl struct {
	*mgo.Collection
}

func (*PermissionColl) Close added in v1.0.1

func (p *PermissionColl) Close()

func (*PermissionColl) Counts added in v1.0.1

func (p *PermissionColl) Counts() int

func (*PermissionColl) Gather added in v1.0.1

func (p *PermissionColl) Gather() ([]plugin.Permission, error)

func (*PermissionColl) Get added in v1.0.1

func (*PermissionColl) GetByDesc added in v1.0.1

func (p *PermissionColl) GetByDesc(descrip string) (plugin.Permission, error)

func (*PermissionColl) Gets added in v1.0.1

func (p *PermissionColl) Gets(skip, limit int, field string) ([]plugin.Permission, error)

func (*PermissionColl) New added in v1.0.1

func (p *PermissionColl) New(name, des string) (string, error)

func (*PermissionColl) Update added in v1.0.1

func (p *PermissionColl) Update(id string, update map[string]string) error

type Role

type Role struct {
	Id          bson.ObjectId `bson:"_id,omitempty" json:"id"`
	Name        string        `bson:"name" json:"name"`
	Permissions string        `bson:"permissions" json:"permissions"`
	CreateTime  time.Time     `bson:"createTime" json:"createTime"`
	UpdateTime  time.Time     `bson:"updateTime,omitempty" json:"updateTime"`
}

func (Role) GetCreateTime added in v1.0.1

func (r Role) GetCreateTime() time.Time

func (Role) GetName added in v1.0.1

func (r Role) GetName() string

func (Role) GetPermissions added in v1.0.1

func (r Role) GetPermissions() string

func (Role) GetUpdateTime added in v1.0.1

func (r Role) GetUpdateTime() time.Time

func (Role) Getid added in v1.0.1

func (r Role) Getid() string

type RoleColl

type RoleColl struct {
	*mgo.Collection
}

func (*RoleColl) Close added in v1.0.1

func (r *RoleColl) Close()

func (*RoleColl) Counts added in v1.0.1

func (r *RoleColl) Counts() int

func (*RoleColl) Gather added in v1.0.1

func (r *RoleColl) Gather() ([]plugin.Role, error)

func (*RoleColl) Get added in v1.0.1

func (r *RoleColl) Get(id string) (plugin.Role, error)

func (*RoleColl) GetByName added in v1.0.1

func (r *RoleColl) GetByName(name string) (plugin.Role, error)

func (*RoleColl) Gets added in v1.0.1

func (r *RoleColl) Gets(skip, limit int, field string) ([]plugin.Role, error)

func (*RoleColl) New added in v1.0.1

func (r *RoleColl) New(name string) (string, error)

func (*RoleColl) Update added in v1.0.1

func (r *RoleColl) Update(id string, update map[string]string) error

type Store added in v1.0.1

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

func Get added in v1.0.1

func Get() *Store

func (*Store) Build added in v1.0.1

func (s *Store) Build()

func (*Store) GetPermissionPools added in v1.0.1

func (s *Store) GetPermissionPools() plugin.PermissionPools

func (*Store) GetRolePools added in v1.0.1

func (s *Store) GetRolePools() plugin.RolePools

func (*Store) GetUserPools added in v1.0.1

func (s *Store) GetUserPools() plugin.UserPools

type User

type User struct {
	Id         bson.ObjectId `bson:"_id,omitempty"`
	UserId     string        `bson:"user_id"`
	Roles      string        `bson:"roles"`
	CreateTime time.Time     `bson:"createTime"`
	UpdateTime time.Time     `bson:"updateTime,omitempty"`
}

func (User) GetCreateTime added in v1.0.1

func (u User) GetCreateTime() time.Time

func (User) GetRoles added in v1.0.1

func (u User) GetRoles() string

func (User) GetUpdateTime added in v1.0.1

func (u User) GetUpdateTime() time.Time

func (User) GetUserId added in v1.0.1

func (u User) GetUserId() string

func (User) Getid added in v1.0.1

func (u User) Getid() string

type UserColl

type UserColl struct {
	*mgo.Collection
}

func (*UserColl) Close added in v1.0.1

func (u *UserColl) Close()

func (*UserColl) Counts added in v1.0.1

func (u *UserColl) Counts() int

func (*UserColl) Gather added in v1.0.1

func (u *UserColl) Gather() ([]plugin.User, error)

func (*UserColl) Get added in v1.0.1

func (u *UserColl) Get(id string) (plugin.User, error)

func (*UserColl) GetByUid added in v1.0.1

func (u *UserColl) GetByUid(uid string) (plugin.User, error)

func (*UserColl) Gets added in v1.0.1

func (u *UserColl) Gets(skip, limit int, field string) ([]plugin.User, error)

func (*UserColl) New added in v1.0.1

func (u *UserColl) New(uid string) (string, error)

func (*UserColl) Update added in v1.0.1

func (u *UserColl) Update(id string, update map[string]string) error

Jump to

Keyboard shortcuts

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