Documentation ¶
Index ¶
- Constants
- func C(name string, values ...interface{}) *mongo.Collection
- func Count(m Modeler, v bson.M) (int64, error)
- func CreateIfNotExist(m Modeler) error
- func DeleteByID(m Modeler, ops ...*options.DeleteOptions) error
- func Find(m Modeler, v bson.M, dec FindDecodeLoop, ops ...*options.FindOptions) error
- func FindByID(m Modeler, ops ...*options.FindOneOptions) error
- func FindOne(m Modeler, v bson.M, ops ...*options.FindOneOptions) error
- func ID(s string) primitive.ObjectID
- func IDExist(m Modeler) bool
- func InitClient(ctx context.Context, ip string) (*mongo.Client, error)
- func InitDB(cfg *config.Configure)
- func InsertOne(m Modeler, ops ...*options.InsertOneOptions) error
- func IsExist(m Modeler, v bson.M) bool
- func Pages(m Modeler, v bson.M, order, limit, current int64, dec FindDecodeLoop) error
- func Ping() error
- func Prefix(values ...interface{}) bool
- func Reconnect() error
- func RelateMaker(fa, fb RelateFunc, f RelateMakeFunc) error
- func SoftDelete(modeler Modeler, v *bson.M) bool
- func Transaction(fn TransactionDo) error
- func UpdateOne(m Modeler, ops ...*options.UpdateOptions) error
- type After
- type BaseAble
- type Before
- type CountAble
- type CreateAble
- type ExorcistUser
- func (u *ExorcistUser) AfterDelete()
- func (u *ExorcistUser) AfterInsert()
- func (u *ExorcistUser) AfterUpdate()
- func (u *ExorcistUser) All() ([]*ExorcistUser, error)
- func (u *ExorcistUser) BeforeDelete()
- func (u *ExorcistUser) BeforeInsert()
- func (u *ExorcistUser) BeforeUpdate()
- func (u *ExorcistUser) Create() error
- func (u *ExorcistUser) CreateIfNotExist() error
- func (u *ExorcistUser) Delete() error
- func (u *ExorcistUser) Find() error
- func (u *ExorcistUser) GetID() primitive.ObjectID
- func (u *ExorcistUser) IsExist() bool
- func (u *ExorcistUser) NoPrefix() NoPrefix
- func (u *ExorcistUser) SetID(id primitive.ObjectID)
- func (u *ExorcistUser) SoftDelete() bool
- func (u *ExorcistUser) Update() error
- type FindDecodeLoop
- type Frame
- type GetAble
- type IPFS
- type Log
- type Media
- func (m *Media) All() ([]*Media, error)
- func (m *Media) Censors() (mcs []*MediaCensor, err error)
- func (m *Media) Create() error
- func (m *Media) CreateIfNotExist() error
- func (m *Media) Delete() error
- func (m *Media) Find() error
- func (m *Media) FindByCensor() (err error)
- func (m *Media) FindByOrg() (medias []*Media, err error)
- func (m *Media) Update() error
- type MediaCensor
- type MediaUser
- func (u *MediaUser) Create() error
- func (u *MediaUser) CreateIfNotExist() error
- func (u *MediaUser) Delete() error
- func (u *MediaUser) Find() error
- func (u *MediaUser) GetID() primitive.ObjectID
- func (u *MediaUser) IsExist() bool
- func (u *MediaUser) Media() (*Media, error)
- func (u *MediaUser) SetID(id primitive.ObjectID)
- func (u *MediaUser) SetMedia(media *Media)
- func (u *MediaUser) SetUser(user *User)
- func (u *MediaUser) Update() error
- func (u *MediaUser) User() (*User, error)
- type Menu
- type Model
- func (m *Model) AfterDelete()
- func (m *Model) AfterInsert()
- func (m *Model) AfterUpdate()
- func (m *Model) BeforeDelete()
- func (m *Model) BeforeInsert()
- func (m *Model) BeforeUpdate()
- func (m *Model) GetID() primitive.ObjectID
- func (m *Model) IsExist() bool
- func (m *Model) NoPrefix() NoPrefix
- func (m *Model) SetID(id primitive.ObjectID)
- func (m *Model) SetSoftDelete(b bool)
- func (m *Model) SoftDelete() bool
- type Modeler
- type MongoDB
- type NoPrefix
- type Node
- type Organization
- func (o *Organization) All() ([]*Organization, error)
- func (o *Organization) Create() error
- func (o *Organization) CreateIfNotExist() error
- func (o *Organization) Delete() error
- func (o *Organization) Find() error
- func (o *Organization) IsExist() bool
- func (o *Organization) Update() error
- func (o *Organization) Users() ([]*User, error)
- type Permission
- func (p *Permission) All() ([]*Permission, error)
- func (p *Permission) Create() error
- func (p *Permission) CreateIfNotExist() error
- func (p *Permission) Delete() error
- func (p *Permission) Find() error
- func (p *Permission) GetID() primitive.ObjectID
- func (p *Permission) IsExist() bool
- func (p *Permission) Menu() (*Menu, error)
- func (p *Permission) Roles() ([]*Role, error)
- func (p *Permission) SetID(id primitive.ObjectID)
- func (p *Permission) Update() error
- func (p *Permission) Users() ([]*User, error)
- type PermissionRole
- func (r *PermissionRole) Create() error
- func (r *PermissionRole) CreateIfNotExist() error
- func (r *PermissionRole) Delete() error
- func (r *PermissionRole) Find() error
- func (r *PermissionRole) GetID() primitive.ObjectID
- func (r *PermissionRole) IsExist() bool
- func (r *PermissionRole) Permission() (*Permission, error)
- func (r *PermissionRole) Role() (*Role, error)
- func (r *PermissionRole) SetID(id primitive.ObjectID)
- func (r *PermissionRole) SetPermission(permission *Permission)
- func (r *PermissionRole) SetRole(role *Role)
- func (r *PermissionRole) Update() error
- type PermissionUser
- func (r *PermissionUser) Create() error
- func (r *PermissionUser) CreateIfNotExist() error
- func (r *PermissionUser) Delete() error
- func (r *PermissionUser) Find() error
- func (r *PermissionUser) GetID() primitive.ObjectID
- func (r *PermissionUser) IsExist() bool
- func (r *PermissionUser) Permission() (*Permission, error)
- func (r *PermissionUser) SetID(id primitive.ObjectID)
- func (r *PermissionUser) SetPermission(permission *Permission)
- func (r *PermissionUser) SetUser(user *User)
- func (r *PermissionUser) Update() error
- func (r *PermissionUser) User() (*User, error)
- type RelateFunc
- type RelateInfo
- type RelateMakeFunc
- type Report
- type Result
- type ResultData
- type Role
- func (r *Role) All() ([]*Role, error)
- func (r *Role) CheckPermission(permission *Permission) error
- func (r *Role) Create() error
- func (r *Role) CreateIfNotExist() error
- func (r *Role) Delete() error
- func (r *Role) Find() error
- func (r *Role) GetID() primitive.ObjectID
- func (r *Role) IsExist() bool
- func (r *Role) Permissions() ([]*Permission, error)
- func (r *Role) SetID(id primitive.ObjectID)
- func (r *Role) Update() error
- func (r *Role) Users() ([]*User, error)
- type RoleUser
- func (r *RoleUser) Create() error
- func (r *RoleUser) CreateIfNotExist() error
- func (r *RoleUser) Delete() error
- func (r *RoleUser) Find() error
- func (r *RoleUser) GetID() primitive.ObjectID
- func (r *RoleUser) IsExist() bool
- func (r *RoleUser) Role() (*Role, error)
- func (r *RoleUser) SetID(id primitive.ObjectID)
- func (r *RoleUser) SetRole(role *Role)
- func (r *RoleUser) SetUser(user *User)
- func (r *RoleUser) Update() error
- func (r *RoleUser) User() (*User, error)
- type SyncAble
- type TransactionDo
- type UpdateAble
- type User
- func (u *User) All() ([]*User, error)
- func (u *User) CacheMenu() error
- func (u *User) CheckPermission(permission *Permission) error
- func (u *User) ClearMenu()
- func (u *User) Create() error
- func (u *User) CreateIfNotExist() error
- func (u *User) Delete() error
- func (u *User) Find() error
- func (u *User) FindMenu() ([]*Menu, error)
- func (u *User) GetMenu() []*Menu
- func (u *User) IsExist() bool
- func (u *User) Organization() (*Organization, error)
- func (u *User) Permissions() ([]*Permission, error)
- func (u *User) Role() (*Role, error)
- func (u *User) SetMenu(menus []*Menu)
- func (u *User) SetPassword(pwd string)
- func (u *User) Update() error
- func (u *User) ValidatePassword(pwd string) bool
Constants ¶
const ( SlugGenesis = "genesis" NameGenesis = "超级管理员" SlugAdmin = "admin" NameAdmin = "节点管理员" SlugOrg = "organization" NameOrg = "组织管理员" SlugMonitor = "monitor" NameMonitor = "监督" SlugUser = "user" NameUser = "普通用户" )
SlugGenesis ...
const DefaultInterval = 30 * time.Second
DefaultInterval ...
const ReportResultObtained = "obtained"
ReportResultObtained ...
const VerifyApplication = "application"
VerifyApplication 申请中
const VerifyClosed = "closed"
VerifyClosed 关闭
const VerifyPass = "pass"
VerifyPass 通过
const VerifyReturn = "return"
VerifyReturn 打回
Variables ¶
This section is empty.
Functions ¶
func Find ¶
func Find(m Modeler, v bson.M, dec FindDecodeLoop, ops ...*options.FindOptions) error
Find ...
func InitClient ¶
InitClient ...
Types ¶
type BaseAble ¶
type BaseAble interface { SyncAble CountAble CreateAble GetAble UpdateAble }
BaseAble ...
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 (*ExorcistUser) CreateIfNotExist ¶
func (u *ExorcistUser) CreateIfNotExist() error
CreateIfNotExist ...
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 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 ...
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 ...
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 ...
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 (*MediaCensor) CreateIfNotExist ¶
func (m *MediaCensor) CreateIfNotExist() error
CreateIfNotExist ...
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 (*MediaUser) CreateIfNotExist ¶
CreateIfNotExist ...
type Menu ¶
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 ...
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 ...
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 ...
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 (*Organization) CreateIfNotExist ¶
func (o *Organization) CreateIfNotExist() error
CreateIfNotExist ...
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 (*Permission) CreateIfNotExist ¶
func (p *Permission) CreateIfNotExist() error
CreateIfNotExist ...
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 (*PermissionRole) CreateIfNotExist ¶
func (r *PermissionRole) CreateIfNotExist() error
CreateIfNotExist ...
func (*PermissionRole) Permission ¶
func (r *PermissionRole) Permission() (*Permission, error)
Permission ...
func (*PermissionRole) SetPermission ¶
func (r *PermissionRole) SetPermission(permission *Permission)
SetPermission ...
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 (*PermissionUser) CreateIfNotExist ¶
func (r *PermissionUser) CreateIfNotExist() error
CreateIfNotExist ...
func (*PermissionUser) Permission ¶
func (r *PermissionUser) Permission() (*Permission, error)
Permission ...
func (*PermissionUser) SetPermission ¶
func (r *PermissionUser) SetPermission(permission *Permission)
SetPermission ...
type RelateInfo ¶
type RelateInfo struct { From string `bson:"from"` LocalField string `bson:"localField"` ForeignField string `json:"foreignField"` As string `json:"as"` }
RelateInfo ...
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 ...
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 (*Role) CheckPermission ¶
func (r *Role) CheckPermission(permission *Permission) error
CheckPermission ...
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 (*RoleUser) CreateIfNotExist ¶
CreateIfNotExist ...
type UpdateAble ¶
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 (*User) CheckPermission ¶
func (u *User) CheckPermission(permission *Permission) error
CheckPermission ...
func (*User) ValidatePassword ¶
ValidatePassword ...