admin

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

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

Go to latest
Published: Jun 19, 2020 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetKVs

func GetKVs(db *mgo.Database, ks ...string) (map[string]string, error)

GetKVs 查询已存在的,对不存在的不报错

func GetValue

func GetValue(db *mgo.Database, k string) (string, error)

GetValue ...

func GetValues

func GetValues(db *mgo.Database, ks ...string) (map[string]string, error)

GetValues 查询已存在的,对不存在的报错

func SetKV

func SetKV(db *mgo.Database, k, v string) error

SetKV ...

func Status

func Status(db *mgo.Database) (map[string]interface{}, error)

Status ...

Types

type Setting

type Setting struct {
	Key     string    `json:"key" bson:"key"`
	Value   string    `json:"value" bson:"value"`
	Created time.Time `json:"created" bson:"created"`
}

Setting ...

type User

type User types.User

User ...

func GetUser

func GetUser(db *mgo.Database, id bson.ObjectId) (*User, error)

GetUser ...

func GetUserByGHAccount

func GetUserByGHAccount(db *mgo.Database, id int) (*User, error)

GetUserByGHAccount ...

func (*User) BindGithub

func (u *User) BindGithub(db *mgo.Database, ghAccount *types.GithubAccount) (*User, error)

BindGithub ...

func (*User) IsAdmin

func (u *User) IsAdmin() bool

IsAdmin ...

func (*User) Login

func (u *User) Login(db *mgo.Database) (*User, error)

Login ...

func (*User) Registry

func (u *User) Registry(db *mgo.Database) (*User, error)

Registry ...

func (*User) RegistryByGHAccount

func (u *User) RegistryByGHAccount(db *mgo.Database, ghAcc *types.GithubAccount) (*User, error)

RegistryByGHAccount ...

type UserAuth

type UserAuth types.UserAuth

types.UserAuth

func AuthSignature

func AuthSignature(db *mgo.Database, apiKey, timestamp, sign string) (*UserAuth, error)

AuthSignature: 验证用户Token

func NewUserAuth

func NewUserAuth(uid bson.ObjectId, expired time.Time) *UserAuth

NewUserAuth: 为用户登录认证新建一个Token

func (*UserAuth) Insert

func (u *UserAuth) Insert(db *mgo.Database) error

Insert

func (*UserAuth) Remove

func (u *UserAuth) Remove(db *mgo.Database) error

Remove

func (*UserAuth) Update

func (u *UserAuth) Update(db *mgo.Database) error

Update

Jump to

Keyboard shortcuts

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