model

package
v0.0.0-...-c649034 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2019 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SlugGenesis = "genesis"
	NameGenesis = "超级管理员"
	SlugAdmin   = "admin"
	NameAdmin   = "节点管理员"
	SlugOrg     = "organization"
	NameOrg     = "组织管理员"
	SlugMonitor = "monitor"
	NameMonitor = "监督"
	SlugUser    = "user"
	NameUser    = "普通用户"
)

SlugGenesis ...

View Source
const DefaultInterval = 30 * time.Second

DefaultInterval ...

View Source
const ReportResultObtained = "obtained"

ReportResultObtained ...

View Source
const VerifyApplication = "application"

VerifyApplication 申请中

View Source
const VerifyClosed = "closed"

VerifyClosed 关闭

View Source
const VerifyPass = "pass"

VerifyPass 通过

View Source
const VerifyReturn = "return"

VerifyReturn 打回

Variables

This section is empty.

Functions

func C

func C(name string, values ...interface{}) *mongo.Collection

C return a collection

func Count

func Count(m Modeler, v bson.M) (int64, error)

Count ...

func CreateIfNotExist

func CreateIfNotExist(m Modeler) error

CreateIfNotExist ...

func DeleteByID

func DeleteByID(m Modeler, ops ...*options.DeleteOptions) error

DeleteByID ...

func Find

func Find(m Modeler, v bson.M, dec FindDecodeLoop, ops ...*options.FindOptions) error

Find ...

func FindByID

func FindByID(m Modeler, ops ...*options.FindOneOptions) error

FindByID ...

func FindOne

func FindOne(m Modeler, v bson.M, ops ...*options.FindOneOptions) error

FindOne ...

func ID

ID ...

func IDExist

func IDExist(m Modeler) bool

IDExist ...

func InitClient

func InitClient(ctx context.Context, ip string) (*mongo.Client, error)

InitClient ...

func InitDB

func InitDB(cfg *config.Configure)

InitDB ...

func InsertOne

func InsertOne(m Modeler, ops ...*options.InsertOneOptions) error

InsertOne ...

func IsExist

func IsExist(m Modeler, v bson.M) bool

IsExist ...

func Pages

func Pages(m Modeler, v bson.M, order, limit, current int64, dec FindDecodeLoop) error

Pages ...

func Ping

func Ping() error

Ping ...

func Prefix

func Prefix(values ...interface{}) bool

Prefix ...

func Reconnect

func Reconnect() error

Reconnect ...

func RelateMaker

func RelateMaker(fa, fb RelateFunc, f RelateMakeFunc) error

RelateMaker ...

func SoftDelete

func SoftDelete(modeler Modeler, v *bson.M) bool

SoftDelete ...

func Transaction

func Transaction(fn TransactionDo) error

Transaction 事物

func UpdateOne

func UpdateOne(m Modeler, ops ...*options.UpdateOptions) error

UpdateOne ...

Types

type After

type After interface {
	AfterInsert()
	AfterUpdate()
	AfterDelete()
}

After ...

type BaseAble

type BaseAble interface {
	SyncAble
	CountAble
	CreateAble
	GetAble
	UpdateAble
}

BaseAble ...

type Before

type Before interface {
	BeforeInsert()
	BeforeUpdate()
	BeforeDelete()
}

Before ...

type CountAble

type CountAble interface {
	Count() (int64, error)
}

CountAble ...

type CreateAble

type CreateAble interface {
	Create() (int64, error)
}

CreateAble ...

type ExorcistUser

type ExorcistUser struct {
	ID        primitive.ObjectID `bson:"_id"`
	Sn        []string           `bson:"sn"`
	IpfsID    []string           `bson:"ipfsid"`
	QuestList []struct {
		ID   string `bson:"id"`
		Code string `bson:"code"`
	} `bson:"questList"`
	Name                  string    `bson:"name"`
	Phone                 string    `bson:"phone"`
	Password              string    `bson:"password"`
	Nickname              string    `bson:"nickname"`
	PictureURL            string    `bson:"pictureUrl"`
	Level                 int       `bson:"level"`
	CreatedAt             time.Time `bson:"createdAt"`
	Binded                bool      `bson:"binded"`
	QueryApply            bool      `bson:"queryApply"`
	Order                 bool      `bson:"order"`
	WhaleCard             string    `bson:"whaleCard"`
	WhaleOrder            string    `bson:"whaleOrder"`
	SlotNum               int       `bson:"slot_num"`
	Approved              bool      `bson:"approved"`
	ParentID              string    `bson:"parentID"`
	Dvc                   string    `bson:"dvc"`
	WhaleDvc              string    `bson:"whaleDvc"`
	DragonBall            string    `bson:"dragonBall"`
	Master                string    `bson:"master"`
	WeChatUnionid         string    `bson:"weChatUnionid"`
	WeChatAppOpenid       string    `bson:"weChatAppOpenid"`
	WeChatAppToken        string    `bson:"weChatAppToken"`
	WeChatAppRefreshToken string    `bson:"weChatAppRefreshToken"`
	Block                 bool      `bson:"block"`
	IP                    string    `bson:"ip"`
	LastLogin             time.Time `bson:"lastLogin"`
	V                     int       `bson:"__v"`
}

ExorcistUser ...

func NewExorcistUser

func NewExorcistUser() *ExorcistUser

NewExorcistUser ...

func (*ExorcistUser) AfterDelete

func (u *ExorcistUser) AfterDelete()

AfterDelete ...

func (*ExorcistUser) AfterInsert

func (u *ExorcistUser) AfterInsert()

AfterInsert ...

func (*ExorcistUser) AfterUpdate

func (u *ExorcistUser) AfterUpdate()

AfterUpdate ...

func (*ExorcistUser) All

func (u *ExorcistUser) All() ([]*ExorcistUser, error)

All ...

func (*ExorcistUser) BeforeDelete

func (u *ExorcistUser) BeforeDelete()

BeforeDelete ...

func (*ExorcistUser) BeforeInsert

func (u *ExorcistUser) BeforeInsert()

BeforeInsert ...

func (*ExorcistUser) BeforeUpdate

func (u *ExorcistUser) BeforeUpdate()

BeforeUpdate ...

func (*ExorcistUser) Create

func (u *ExorcistUser) Create() error

Create ...

func (*ExorcistUser) CreateIfNotExist

func (u *ExorcistUser) CreateIfNotExist() error

CreateIfNotExist ...

func (*ExorcistUser) Delete

func (u *ExorcistUser) Delete() error

Delete ...

func (*ExorcistUser) Find

func (u *ExorcistUser) Find() error

Find ...

func (*ExorcistUser) GetID

func (u *ExorcistUser) GetID() primitive.ObjectID

GetID ...

func (*ExorcistUser) IsExist

func (u *ExorcistUser) IsExist() bool

IsExist ...

func (*ExorcistUser) NoPrefix

func (u *ExorcistUser) NoPrefix() NoPrefix

NoPrefix ...

func (*ExorcistUser) SetID

func (u *ExorcistUser) SetID(id primitive.ObjectID)

SetID ...

func (*ExorcistUser) SoftDelete

func (u *ExorcistUser) SoftDelete() bool

SoftDelete ...

func (*ExorcistUser) Update

func (u *ExorcistUser) Update() error

Update ...

type FindDecodeLoop

type FindDecodeLoop func(cursor mongo.Cursor) error

FindDecodeLoop ...

type Frame

type Frame struct {
	URL       string  `json:"url,omitempty"`
	Offset    int64   `json:"offset"`
	Rate      float64 `json:"rate,omitempty"`
	SfaceData []struct {
		Faces []struct {
			ID   string  `json:"id,omitempty"`
			Name string  `json:"name,omitempty"`
			Rate float64 `json:"rate,omitempty"`
		} `json:"faces,omitempty"`
		H int `json:"h,omitempty"`
		W int `json:"w,omitempty"`
		X int `json:"x,omitempty"`
		Y int `json:"y,omitempty"`
	} `json:"sfaceData,omitempty"`
}

Frame ...

type GetAble

type GetAble interface {
	Get() (bool, error)
	List(v interface{}) error
}

GetAble ...

type IPFS

type IPFS struct {
	Model       `bson:",inline"`
	MediaID     primitive.ObjectID `bson:"media_id"`
	FileID      string             `bson:"file_id"`
	IPFSAddress string             `bson:"ipfs_address"`
	IPNSAddress string             `bson:"ipns_address"`
	IpnsKey     string             `bson:"ipns_key"`
	Status      string             `bson:"status"`
}

IPFS ...

func NewIPFS

func NewIPFS() *IPFS

NewIPFS ...

func (*IPFS) Create

func (i *IPFS) Create() error

Create ...

func (*IPFS) CreateIfNotExist

func (i *IPFS) CreateIfNotExist() error

CreateIfNotExist ...

func (*IPFS) Delete

func (i *IPFS) Delete() error

Delete ...

func (*IPFS) Find

func (i *IPFS) Find() error

Find ...

func (*IPFS) FindByFileID

func (i *IPFS) FindByFileID() error

FindByFileID ...

func (*IPFS) Update

func (i *IPFS) Update() error

Update ...

type Log

type Log struct {
	Model      `bson:",inline"`
	UserID     primitive.ObjectID `bson:"user_id"`
	Method     string             `bson:"method"`
	URL        string             `bson:"url"`
	Permission string             `bson:"permission"`
	Err        string             `bson:"err"`
	Detail     string             `bson:"detail"`
	VisitIP    string             `bson:"visit_ip"`
}

Log ...

func NewLog

func NewLog() *Log

NewLog ...

func (*Log) All

func (l *Log) All() ([]*Log, error)

All ...

func (*Log) Create

func (l *Log) Create() error

Create ...

func (*Log) CreateIfNotExist

func (l *Log) CreateIfNotExist() error

CreateIfNotExist ...

func (*Log) Delete

func (l *Log) Delete() error

Delete ...

func (*Log) Find

func (l *Log) Find() error

Find ...

func (*Log) Pages

func (l *Log) Pages(order, limit, current int64) ([]*Log, int64)

Pages ...

func (*Log) Update

func (l *Log) Update() error

Update ...

type Media

type Media struct {
	Model             `bson:",inline"`
	OrganizationID    primitive.ObjectID `bson:"organization_id"`     //组织id
	CensorID          primitive.ObjectID `bson:"censor_id"`           //AI检查状态
	CensorResult      string             `bson:"censor_result"`       //鉴定结果
	Block             bool               `bson:"block"`               //禁止访问
	VIPFree           string             `bson:"vip_free"`            //Vip免费
	Photo             string             `bson:"photo"`               //照片
	Name              string             `bson:"name"`                //名称
	Type              string             `bson:"type"`                //类别
	Language          string             `bson:"language"`            //语言
	Output3D          string             `bson:"output_3d"`           //3D
	VR                string             `bson:"vr"`                  //VR
	Thumb             string             `bson:"thumb"`               //缩略图
	Introduction      string             `bson:"introduction"`        //简介
	Starring          string             `bson:"starring"`            //主演
	Director          string             `bson:"director"`            //导演
	Episode           string             `bson:"episode"`             //集数
	TotalNumber       string             `bson:"total_number"`        //总集数
	IPNSAddress       string             `bson:"ipns_address"`        //ipns地址
	IPFSAddress       string             `bson:"ipfs_address"`        //ipfs地址
	VideoOSSAddress   string             `bson:"video_oss_address"`   //视频oss地址
	PictureOSSAddress []string           `bson:"picture_oss_address"` //图片oss地址
	Key               string             `bson:"key"`                 //m3u8加密key
	KeyAddress        string             `bson:"key_address"`         //key地址
	Price             string             `bson:"price"`               //价格
	PlayType          string             `bson:"play_type"`           //播放类型(单次,多次)
	ExpireDate        string             `bson:"expire_date"`         //过期时间(48H,24H,0H)
}

Media ...

func NewMedia

func NewMedia() *Media

NewMedia ...

func (*Media) All

func (m *Media) All() ([]*Media, error)

All ...

func (*Media) Censors

func (m *Media) Censors() (mcs []*MediaCensor, err error)

Censors ...

func (*Media) Create

func (m *Media) Create() error

Create ...

func (*Media) CreateIfNotExist

func (m *Media) CreateIfNotExist() error

CreateIfNotExist ...

func (*Media) Delete

func (m *Media) Delete() error

Delete ...

func (*Media) Find

func (m *Media) Find() error

Find ...

func (*Media) FindByCensor

func (m *Media) FindByCensor() (err error)

FindByCensor ...

func (*Media) FindByOrg

func (m *Media) FindByOrg() (medias []*Media, err error)

FindByOrg ...

func (*Media) Update

func (m *Media) Update() error

Update ...

type MediaCensor

type MediaCensor struct {
	Model      `bson:",inline"`
	MediaID    primitive.ObjectID `bson:"media_id"`
	Verify     string             `bson:"verify"` //AI审核结果判断
	Offset     int64              `bson:"offset"`
	RequestKey string             `bson:"request_key"`
	ResultData []*ResultData      `bson:"result_data,omitempty"`
}

MediaCensor ...

func NewMediaCensor

func NewMediaCensor() *MediaCensor

NewMediaCensor ...

func (*MediaCensor) Create

func (m *MediaCensor) Create() error

Create ...

func (*MediaCensor) CreateIfNotExist

func (m *MediaCensor) CreateIfNotExist() error

CreateIfNotExist ...

func (*MediaCensor) Delete

func (m *MediaCensor) Delete() error

Delete ...

func (*MediaCensor) Find

func (m *MediaCensor) Find() error

Find ...

func (*MediaCensor) FindByKey

func (m *MediaCensor) FindByKey() error

FindByKey ...

func (*MediaCensor) Media

func (m *MediaCensor) Media() (*Media, error)

Media ...

func (*MediaCensor) Update

func (m *MediaCensor) Update() error

Update ...

type MediaUser

type MediaUser struct {
	Model   `bson:",inline"`
	UserID  primitive.ObjectID `bson:"user_id"`
	MediaID primitive.ObjectID `bson:"media_id"`
	// contains filtered or unexported fields
}

MediaUser ...

func NewMediaUser

func NewMediaUser() *MediaUser

NewMediaUser ...

func (*MediaUser) Create

func (u *MediaUser) Create() error

Create ...

func (*MediaUser) CreateIfNotExist

func (u *MediaUser) CreateIfNotExist() error

CreateIfNotExist ...

func (*MediaUser) Delete

func (u *MediaUser) Delete() error

Delete ...

func (*MediaUser) Find

func (u *MediaUser) Find() error

Find ...

func (*MediaUser) GetID

func (u *MediaUser) GetID() primitive.ObjectID

GetID ...

func (*MediaUser) IsExist

func (u *MediaUser) IsExist() bool

IsExist ...

func (*MediaUser) Media

func (u *MediaUser) Media() (*Media, error)

Media ...

func (*MediaUser) SetID

func (u *MediaUser) SetID(id primitive.ObjectID)

SetID ...

func (*MediaUser) SetMedia

func (u *MediaUser) SetMedia(media *Media)

SetMedia ...

func (*MediaUser) SetUser

func (u *MediaUser) SetUser(user *User)

SetUser ...

func (*MediaUser) Update

func (u *MediaUser) Update() error

Update ...

func (*MediaUser) User

func (u *MediaUser) User() (*User, error)

User ...

type Menu struct {
	Model       `bson:",inline"`
	PID         primitive.ObjectID `bson:"pid"`         //菜单关系
	Name        string             `bson:"name"`        //菜单名称
	Icon        string             `bson:"icon"`        //图标
	Slug        string             `bson:"slug"`        //菜单对应的权限
	URL         string             `bson:"url"`         //菜单链接地址
	Active      string             `bson:"active"`      //菜单高亮地址
	Description string             `bson:"description"` //描述
	Sort        int                `bson:"sort"`        //排序
}

Menu ...

func NewMenu

func NewMenu() *Menu

NewMenu ...

func (m *Menu) All() ([]*Menu, error)

All ...

func (m *Menu) Create() error

Create ...

func (m *Menu) CreateIfNotExist() error

CreateIfNotExist ...

func (m *Menu) Delete() error

Delete ...

func (m *Menu) Find() error

Find ...

func (m *Menu) Update() error

Update ...

type Model

type Model struct {
	ID        primitive.ObjectID `bson:"_id,omitempty"`
	CreatedAt time.Time          `bson:"created_at"`
	UpdatedAt time.Time          `bson:"updated_at"`
	DeletedAt *time.Time         `bson:"deleted_at"`
	Version   int                `bson:"version"`
	// contains filtered or unexported fields
}

Model ...

func NewModel

func NewModel() *Model

NewModel ...

func (*Model) AfterDelete

func (m *Model) AfterDelete()

AfterDelete ...

func (*Model) AfterInsert

func (m *Model) AfterInsert()

AfterInsert ...

func (*Model) AfterUpdate

func (m *Model) AfterUpdate()

AfterUpdate ...

func (*Model) BeforeDelete

func (m *Model) BeforeDelete()

BeforeDelete ...

func (*Model) BeforeInsert

func (m *Model) BeforeInsert()

BeforeInsert ...

func (*Model) BeforeUpdate

func (m *Model) BeforeUpdate()

BeforeUpdate ...

func (*Model) GetID

func (m *Model) GetID() primitive.ObjectID

GetID ...

func (*Model) IsExist

func (m *Model) IsExist() bool

IsExist ...

func (*Model) NoPrefix

func (m *Model) NoPrefix() NoPrefix

NoPrefix ...

func (*Model) SetID

func (m *Model) SetID(id primitive.ObjectID)

SetID ...

func (*Model) SetSoftDelete

func (m *Model) SetSoftDelete(b bool)

SetSoftDelete ...

func (*Model) SoftDelete

func (m *Model) SoftDelete() bool

SoftDelete ...

type Modeler

type Modeler interface {
	Before
	After
	NoPrefix() NoPrefix
	IsExist() bool
	GetID() primitive.ObjectID
	SetID(id primitive.ObjectID)
	CreateIfNotExist() error
	Create() error
	Update() error
	Delete() error
	Find() error
	SoftDelete() bool
	// contains filtered or unexported methods
}

Modeler ...

type MongoDB

type MongoDB struct {
	*mongo.Client
	Interval time.Duration
	// contains filtered or unexported fields
}

MongoDB ...

func DB

func DB() *MongoDB

DB ...

func (*MongoDB) D

func (m *MongoDB) D() *mongo.Database

D ...

func (*MongoDB) Limit

func (m *MongoDB) Limit() *int64

Limit ...

func (*MongoDB) SetLimit

func (m *MongoDB) SetLimit(limit int64)

SetLimit ...

func (*MongoDB) TimeOut

func (m *MongoDB) TimeOut() context.Context

TimeOut ...

type NoPrefix

type NoPrefix bool

NoPrefix ...

type Node

type Node struct {
	Name           string
	Type           string
	Property       string
	OrganizationID primitive.ObjectID
	NodeIP         string
	NodePort       string
}

Node 节点

type Organization

type Organization struct {
	Model                  `bson:",inline"`
	IsDefault              bool   `bson:"is_default"`                //是否为默认
	Verify                 string `bson:"verify"`                    //验证状态
	Corporate              string `bson:"corporate"`                 //企业法人
	CorporateIDCardFacade  string `bson:"corporate_id_card_facade"`  //法人身份证(正)
	CorporateIDCardObverse string `bson:"corporate_id_card_obverse"` //法人身份证(反)
	BusinessLicense        string `bson:"business_license"`          //营业执照
	Name                   string `bson:"name"`                      //商户名称
	Code                   string `bson:"code"`                      //社会统一信用代码
	Contact                string `bson:"contact"`                   //商户联系人
	Position               string `bson:"position"`                  //联系人职位
	Phone                  string `bson:"phone"`                     //联系人手机号
	Mailbox                string `bson:"mailbox"`                   //联系人邮箱
	IDCardFacade           string `bson:"id_card_facade"`            //联系人身份证(正)
	IDCardObverse          string `bson:"id_card_obverse"`           //联系人身份证(反)
	Description            string `bson:"description"`               //描述
}

Organization ...

func NewOrganization

func NewOrganization() *Organization

NewOrganization ...

func (*Organization) All

func (o *Organization) All() ([]*Organization, error)

All ...

func (*Organization) Create

func (o *Organization) Create() error

Create ...

func (*Organization) CreateIfNotExist

func (o *Organization) CreateIfNotExist() error

CreateIfNotExist ...

func (*Organization) Delete

func (o *Organization) Delete() error

Delete ...

func (*Organization) Find

func (o *Organization) Find() error

Find ...

func (*Organization) IsExist

func (o *Organization) IsExist() bool

IsExist ...

func (*Organization) Update

func (o *Organization) Update() error

Update ...

func (*Organization) Users

func (o *Organization) Users() ([]*User, error)

Users ...

type Permission

type Permission struct {
	Model           `bson:",inline"`
	Name            string `bson:"name"`
	Slug            string `bson:"slug"`
	Description     string `bson:"description"`
	PermissionModel string `bson:"permission_model"`
}

Permission ...

func NewPermission

func NewPermission() *Permission

NewPermission ...

func (*Permission) All

func (p *Permission) All() ([]*Permission, error)

All ...

func (*Permission) Create

func (p *Permission) Create() error

Create ...

func (*Permission) CreateIfNotExist

func (p *Permission) CreateIfNotExist() error

CreateIfNotExist ...

func (*Permission) Delete

func (p *Permission) Delete() error

Delete ...

func (*Permission) Find

func (p *Permission) Find() error

Find ...

func (*Permission) GetID

func (p *Permission) GetID() primitive.ObjectID

GetID ...

func (*Permission) IsExist

func (p *Permission) IsExist() bool

IsExist ...

func (*Permission) Menu

func (p *Permission) Menu() (*Menu, error)

Menu ...

func (*Permission) Roles

func (p *Permission) Roles() ([]*Role, error)

Roles ...

func (*Permission) SetID

func (p *Permission) SetID(id primitive.ObjectID)

SetID ...

func (*Permission) Update

func (p *Permission) Update() error

Update ...

func (*Permission) Users

func (p *Permission) Users() ([]*User, error)

Users ...

type PermissionRole

type PermissionRole struct {
	Model        `bson:",inline"`
	PermissionID primitive.ObjectID `bson:"permission_id"`
	RoleID       primitive.ObjectID `bson:"role_id"`
	// contains filtered or unexported fields
}

PermissionRole ...

func NewPermissionRole

func NewPermissionRole() *PermissionRole

NewPermissionRole ...

func (*PermissionRole) Create

func (r *PermissionRole) Create() error

Create ...

func (*PermissionRole) CreateIfNotExist

func (r *PermissionRole) CreateIfNotExist() error

CreateIfNotExist ...

func (*PermissionRole) Delete

func (r *PermissionRole) Delete() error

Delete ...

func (*PermissionRole) Find

func (r *PermissionRole) Find() error

Find ...

func (*PermissionRole) GetID

func (r *PermissionRole) GetID() primitive.ObjectID

GetID ...

func (*PermissionRole) IsExist

func (r *PermissionRole) IsExist() bool

IsExist ...

func (*PermissionRole) Permission

func (r *PermissionRole) Permission() (*Permission, error)

Permission ...

func (*PermissionRole) Role

func (r *PermissionRole) Role() (*Role, error)

Role ...

func (*PermissionRole) SetID

func (r *PermissionRole) SetID(id primitive.ObjectID)

SetID ...

func (*PermissionRole) SetPermission

func (r *PermissionRole) SetPermission(permission *Permission)

SetPermission ...

func (*PermissionRole) SetRole

func (r *PermissionRole) SetRole(role *Role)

SetRole ...

func (*PermissionRole) Update

func (r *PermissionRole) Update() error

Update ...

type PermissionUser

type PermissionUser struct {
	Model        `bson:",inline"`
	PermissionID primitive.ObjectID `bson:"permission_id"`
	UserID       primitive.ObjectID `bson:"user_id"`
	// contains filtered or unexported fields
}

PermissionUser ...

func NewPermissionUser

func NewPermissionUser() *PermissionUser

NewPermissionUser ...

func (*PermissionUser) Create

func (r *PermissionUser) Create() error

Create ...

func (*PermissionUser) CreateIfNotExist

func (r *PermissionUser) CreateIfNotExist() error

CreateIfNotExist ...

func (*PermissionUser) Delete

func (r *PermissionUser) Delete() error

Delete ...

func (*PermissionUser) Find

func (r *PermissionUser) Find() error

Find ...

func (*PermissionUser) GetID

func (r *PermissionUser) GetID() primitive.ObjectID

GetID ...

func (*PermissionUser) IsExist

func (r *PermissionUser) IsExist() bool

IsExist ...

func (*PermissionUser) Permission

func (r *PermissionUser) Permission() (*Permission, error)

Permission ...

func (*PermissionUser) SetID

func (r *PermissionUser) SetID(id primitive.ObjectID)

SetID ...

func (*PermissionUser) SetPermission

func (r *PermissionUser) SetPermission(permission *Permission)

SetPermission ...

func (*PermissionUser) SetUser

func (r *PermissionUser) SetUser(user *User)

SetUser ...

func (*PermissionUser) Update

func (r *PermissionUser) Update() error

Update ...

func (*PermissionUser) User

func (r *PermissionUser) User() (*User, error)

User ...

type RelateFunc

type RelateFunc func() (Modeler, error)

RelateFunc ...

type RelateInfo

type RelateInfo struct {
	From         string `bson:"from"`
	LocalField   string `bson:"localField"`
	ForeignField string `json:"foreignField"`
	As           string `json:"as"`
}

RelateInfo ...

type RelateMakeFunc

type RelateMakeFunc func(a, b Modeler) error

RelateMakeFunc ...

type Report

type Report struct {
	Model         `bson:",inline"`
	MediaID       primitive.ObjectID `json:"media_id" bson:"media_id"`             //举报视频ID
	ExoID         primitive.ObjectID `json:"exo_id" bson:"exo_id"`                 //用户ID
	Types         string             `json:"types" bson:"types"`                   //举报类型
	Detail        string             `json:"detail" bson:"detail"`                 //举报详情
	ProcessResult string             `json:"process_result" bson:"process_result"` //处理结果
}

Report ...

func NewReport

func NewReport() *Report

NewReport ...

func (*Report) All

func (r *Report) All() ([]*Report, error)

All ...

func (*Report) Create

func (r *Report) Create() error

Create ...

func (*Report) CreateIfNotExist

func (r *Report) CreateIfNotExist() error

CreateIfNotExist ...

func (*Report) Delete

func (r *Report) Delete() error

Delete ...

func (*Report) Find

func (r *Report) Find() error

Find ...

func (*Report) Media

func (r *Report) Media() (*Media, error)

Media ...

func (*Report) UnmarshalJSON

func (r *Report) UnmarshalJSON(b []byte) error

UnmarshalJSON ...

func (*Report) Update

func (r *Report) Update() error

Update ...

type Result

type Result struct {
	Frames     []Frame `json:"frames"`
	Label      string  `json:"label"`
	Rate       float64 `json:"rate"`
	Scene      string  `json:"scene"`
	Suggestion string  `json:"suggestion"`
}

Result ...

type ResultData

type ResultData struct {
	Code int `json:"code"`
	Data []struct {
		Code   int    `json:"code"`
		DataID string `json:"dataId"`
		Extras struct {
		} `json:"extras"`
		Msg     string   `json:"msg"`
		Results []Result `json:"results"`
		TaskID  string   `json:"taskId"`
		URL     string   `json:"url"`
	} `json:"data"`
	Msg       string `json:"msg"`
	RequestID string `json:"requestId"`
}

ResultData ...

type Role

type Role struct {
	Model       `bson:",inline"`
	Name        string `bson:"name"`
	Slug        string `bson:"slug"`
	Description string `bson:"description"`
	Level       int    `bson:"level"`
}

Role ...

func NewAdminRole

func NewAdminRole() *Role

NewAdminRole ...

func NewGenesisRole

func NewGenesisRole() *Role

NewGenesisRole ...

func NewGodRole

func NewGodRole() *Role

NewGodRole 用户就是上帝

func NewMonitorRole

func NewMonitorRole() *Role

NewMonitorRole ...

func NewOrgRole

func NewOrgRole() *Role

NewOrgRole ...

func NewRole

func NewRole() *Role

NewRole ...

func (*Role) All

func (r *Role) All() ([]*Role, error)

All ...

func (*Role) CheckPermission

func (r *Role) CheckPermission(permission *Permission) error

CheckPermission ...

func (*Role) Create

func (r *Role) Create() error

Create ...

func (*Role) CreateIfNotExist

func (r *Role) CreateIfNotExist() error

CreateIfNotExist ...

func (*Role) Delete

func (r *Role) Delete() error

Delete ...

func (*Role) Find

func (r *Role) Find() error

Find ...

func (*Role) GetID

func (r *Role) GetID() primitive.ObjectID

GetID ...

func (*Role) IsExist

func (r *Role) IsExist() bool

IsExist ...

func (*Role) Permissions

func (r *Role) Permissions() ([]*Permission, error)

Permissions ...

func (*Role) SetID

func (r *Role) SetID(id primitive.ObjectID)

SetID ...

func (*Role) Update

func (r *Role) Update() error

Update ...

func (*Role) Users

func (r *Role) Users() ([]*User, error)

Users ...

type RoleUser

type RoleUser struct {
	Model  `bson:",inline"`
	UserID primitive.ObjectID `bson:"user_id"`
	RoleID primitive.ObjectID `bson:"role_id"`
	// contains filtered or unexported fields
}

RoleUser ...

func NewRoleUser

func NewRoleUser() *RoleUser

NewRoleUser ...

func (*RoleUser) Create

func (r *RoleUser) Create() error

Create ...

func (*RoleUser) CreateIfNotExist

func (r *RoleUser) CreateIfNotExist() error

CreateIfNotExist ...

func (*RoleUser) Delete

func (r *RoleUser) Delete() error

Delete ...

func (*RoleUser) Find

func (r *RoleUser) Find() error

Find ...

func (*RoleUser) GetID

func (r *RoleUser) GetID() primitive.ObjectID

GetID ...

func (*RoleUser) IsExist

func (r *RoleUser) IsExist() bool

IsExist ...

func (*RoleUser) Role

func (r *RoleUser) Role() (*Role, error)

Role ...

func (*RoleUser) SetID

func (r *RoleUser) SetID(id primitive.ObjectID)

SetID ...

func (*RoleUser) SetRole

func (r *RoleUser) SetRole(role *Role)

SetRole ...

func (*RoleUser) SetUser

func (r *RoleUser) SetUser(user *User)

SetUser ...

func (*RoleUser) Update

func (r *RoleUser) Update() error

Update ...

func (*RoleUser) User

func (r *RoleUser) User() (*User, error)

User ...

type SyncAble

type SyncAble interface {
	Sync() error
}

SyncAble ...

type TransactionDo

type TransactionDo func() error

TransactionDo ...

type UpdateAble

type UpdateAble interface {
	Update() (int64, error)
	UpdateOnly(cols ...string) (int64, error)
}

UpdateAble ...

type User

type User struct {
	Model          `bson:",inline"`
	Block          bool               `bson:"block"`           //禁止访问
	Name           string             `bson:"name"`            //名称
	Username       string             `bson:"username"`        //用户名
	Email          string             `bson:"email"`           //邮件
	Mobile         string             `bson:"mobile"`          //移动电话
	IDCardFacade   string             `bson:"id_card_facade"`  //身份证(正)
	IDCardObverse  string             `bson:"id_card_obverse"` //身份证(反)
	OrganizationID primitive.ObjectID `bson:"organization_id"` //组织ID
	Password       string             `bson:"password"`        //密码
	Certificate    string             `bson:"certificate"`     //证书
	PrivateKey     string             `bson:"private_key"`     //私钥
	LoginIP        string             `bson:"login_ip"`        //本次登录IP
	Token          string             `bson:"token" json:"-"`
	Menus          []*Menu            `bson:"menus"`
	// contains filtered or unexported fields
}

User ...

func NewUser

func NewUser() *User

NewUser ...

func (*User) All

func (u *User) All() ([]*User, error)

All ...

func (*User) CacheMenu

func (u *User) CacheMenu() error

CacheMenu ...

func (*User) CheckPermission

func (u *User) CheckPermission(permission *Permission) error

CheckPermission ...

func (*User) ClearMenu

func (u *User) ClearMenu()

ClearMenu ...

func (*User) Create

func (u *User) Create() error

Create ...

func (*User) CreateIfNotExist

func (u *User) CreateIfNotExist() error

CreateIfNotExist ...

func (*User) Delete

func (u *User) Delete() error

Delete ...

func (*User) Find

func (u *User) Find() error

Find ...

func (*User) FindMenu

func (u *User) FindMenu() ([]*Menu, error)

FindMenu ...

func (*User) GetMenu

func (u *User) GetMenu() []*Menu

GetMenu ...

func (*User) IsExist

func (u *User) IsExist() bool

IsExist ...

func (*User) Organization

func (u *User) Organization() (*Organization, error)

Organization ...

func (*User) Permissions

func (u *User) Permissions() ([]*Permission, error)

Permissions ...

func (*User) Role

func (u *User) Role() (*Role, error)

Role ...

func (*User) SetMenu

func (u *User) SetMenu(menus []*Menu)

SetMenu ...

func (*User) SetPassword

func (u *User) SetPassword(pwd string)

SetPassword ...

func (*User) Update

func (u *User) Update() error

Update ...

func (*User) ValidatePassword

func (u *User) ValidatePassword(pwd string) bool

ValidatePassword ...

Jump to

Keyboard shortcuts

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