schema

package
v0.0.0-...-d817ec6 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Copyright 2019-2020 Axetroy. All rights reserved. Apache License 2.0.

Copyright 2019-2020 Axetroy. All rights reserved. Apache License 2.0.

Copyright 2019-2020 Axetroy. All rights reserved. Apache License 2.0.

Copyright 2019-2020 Axetroy. All rights reserved. Apache License 2.0.

Copyright 2019-2020 Axetroy. All rights reserved. Apache License 2.0.

Index

Constants

View Source
const (
	StatusSuccess = 1
	StatusFail    = 0
)

Variables

View Source
var (
	DefaultLimit       = 10            // 默认只获取 10 条数据
	DefaultPage        = 1             // 默认第 1 页
	DefaultSort        = "-created_at" // 默认按照创建时间排序
	MaxLimit           = 100           // 最大的查询数量,100 条 防止查询数据过大拖慢服务端性能
	OrderAsc     Order = "ASC"         // 排序方式,正序
	OrderDesc    Order = "DESC"        // 排序方式,倒序

)

Functions

This section is empty.

Types

type Host

type Host struct {
	HostPure
	CreatedAt string `json:"created_at"`
	UpdatedAt string `json:"updated_at"`
}

type HostConnectionRecord

type HostConnectionRecord struct {
	HostConnectionRecordPure
	CreatedAt string `json:"created_at"`
	UpdatedAt string `json:"updated_at"`
}

type HostConnectionRecordPure

type HostConnectionRecordPure struct {
	ID      string        `json:"id"`
	UserID  string        `json:"user_id"`
	User    ProfilePublic `json:"user"`
	HostID  string        `json:"host_id"`
	Host    HostPure      `json:"host"`
	Records []string      `json:"records"`
}

type HostPure

type HostPure struct {
	Id          string             `json:"id"`
	Name        string             `json:"name"`
	OwnerID     string             `json:"owner_id"`
	OwnerType   db.HostOwnerType   `json:"owner_type"`
	Host        string             `json:"host"`
	Port        uint               `json:"port"`
	Username    string             `json:"username"`
	ConnectType db.HostConnectType `json:"connect_type"`
	Remark      *string            `json:"remark"`
}

服务器的相关信息

type Meta

type Meta struct {
	Limit    int     `json:"limit"`              // 当前请求获取多少条数据, 默认 10
	Page     int     `json:"page"`               // 当前第几页,默认 0 开始
	Total    int64   `json:"total"`              // 数据总量
	Num      int     `json:"num"`                // 当前返回的数据流
	Sort     string  `json:"sort"`               // 排序
	Platform *string `json:"platform,omitempty"` // 平台
}

type Order

type Order string

type Profile

type Profile struct {
	ProfilePure
	CreatedAt string `json:"created_at"`
	UpdatedAt string `json:"updated_at"`
}

type ProfilePublic

type ProfilePublic struct {
	Id       string  `json:"id"`
	Username string  `json:"username"`
	Nickname *string `json:"nickname"`
	Avatar   string  `json:"avatar"`
}

公开的用户资料,任何人都可以查阅

type ProfilePure

type ProfilePure struct {
	Id       string  `json:"id"`
	Username string  `json:"username"`
	Nickname *string `json:"nickname"`
	//Email    *string  `json:"email"`
	//Phone    *string  `json:"phone"`
	//Status   int32    `json:"status"`
	Gender int    `json:"gender"`
	Avatar string `json:"avatar"`
}

用户自己的资料

type ProfileWithToken

type ProfileWithToken struct {
	Profile
	Token string `json:"token"`
}

type Query

type Query struct {
	Limit    int     `json:"limit" form:"limit"`
	Page     int     `json:"page" form:"page"`
	Sort     string  `json:"sort" form:"sort"`
	Platform *string `json:"platform" form:"platform"`
}

func (*Query) Normalize

func (q *Query) Normalize() *Query

func (*Query) Offset

func (q *Query) Offset() uint32

func (*Query) Order

func (q *Query) Order() string

type Response

type Response struct {
	Message string      `json:"message"`        // 附带的消息,接口请求错误时,一般都会有错误信息
	Data    interface{} `json:"data"`           // 接口附带的数据
	Status  int         `json:"status"`         // 状态码,非 1 状态码则为错误
	Meta    *Meta       `json:"meta,omitempty"` // 数据列表多了一个 Meta 字段
}

func (Response) Decode

func (r Response) Decode(dest interface{}) (err error)

type Sort

type Sort struct {
	Field string `json:"field"` // 排序的字段
	Order Order  `json:"order"` // 字段的排序方向
}

type Team

type Team struct {
	TeamPure
	CreatedAt string `json:"created_at"`
	UpdatedAt string `json:"updated_at"`
}

type TeamMember

type TeamMember struct {
	ProfilePublic
	Role      db.TeamRole `json:"role"`       // 用户在团队的角色
	CreatedAt string      `json:"created_at"` // 用户加入团队的时间
}

团队成员信息

type TeamMemberInvite

type TeamMemberInvite struct {
	TeamMemberInvitePure
	Team      TeamPure      `json:"team"`    // 邀请的团队
	User      ProfilePublic `json:"user"`    // 被邀请的用户
	Invitor   ProfilePublic `json:"invitor"` // 邀请人
	CreatedAt string        `json:"created_at"`
	UpdatedAt string        `json:"updated_at"`
}

type TeamMemberInvitePure

type TeamMemberInvitePure struct {
	ID     string         `json:"id"`
	Role   db.TeamRole    `json:"role"`
	State  db.InviteState `json:"state"`
	Remark *string        `json:"remark"`
}

type TeamPure

type TeamPure struct {
	Id      string        `json:"id"`
	Name    string        `json:"name"`
	OwnerID string        `json:"owner_id"`
	Owner   ProfilePublic `json:"owner"`
	Remark  *string       `json:"remark"`
}

团队信息相关

type TeamStat

type TeamStat struct {
	Team
	MemberNum int `json:"member_num"` // 团队的成员数量
	HostNum   int `json:"host_num"`   // 拥有的服务器数量
}

type TeamWithMember

type TeamWithMember struct {
	TeamPure
	Owner     ProfilePublic `json:"owner"`   // 团队拥有者的基本信息
	UserID    string        `json:"user_id"` // 用户 ID
	Role      db.TeamRole   `json:"role"`    // 用户在团队中扮演的角色
	CreatedAt string        `json:"created_at"`
	UpdatedAt string        `json:"updated_at"`
}

Jump to

Keyboard shortcuts

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