db

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseField

type BaseField struct {
	Id         uint  `db:"id" json:"id"`
	AddTime    int64 `db:"add_time" json:"add_time"`
	UpdateTime int64 `db:"update_time" json:"-"`
}

可能为null的字段, 用指针

func (*BaseField) AddTimeFormat

func (b *BaseField) AddTimeFormat() string

func (*BaseField) UpdateTimeFormat

func (b *BaseField) UpdateTimeFormat() string

type Dating

type Dating struct {
	BaseField
	CreateUserId uint   `db:"create_user_id" json:"create_user_id" info:"会面创建者"`
	Result       string `db:"result" json:"result" info:"推荐结果"`
	Status       int8   `db:"status" json:"status" info:"会面状态; 0:结束;1:进行中;"`
	AddTime      int64  `db:"add_time" json:"-"`
}

func (*Dating) ResultUnmarshal

func (d *Dating) ResultUnmarshal() *DatingResult

json转结构体

func (Dating) TableName

func (Dating) TableName() string

type DatingResult

type DatingResult struct {
	Res  bool  `json:"r" info:"匹配是否成功"`
	Date []int `json:"d" info:"建议时间, 放时间戳"`
}

Result的数据

func (*DatingResult) Marshal

func (d *DatingResult) Marshal() string

结构体转json

type Dbfunc

type Dbfunc interface {
	TableName() string
}

所有数据库结构体 都需实现的接口

type Feedback

type Feedback struct {
	BaseField
	Desc   string `db:"desc" json:"desc" info:"反馈详情"`
	UserId uint   `db:"user_id" json:"user_id" info:"反馈人"`
	FileId string `db:"file_id" json:"file_id" info:"file表id, 逗号相隔"`
}

func (Feedback) TableName

func (Feedback) TableName() string

type File

type File struct {
	BaseField        // (实质上当前表并没有update_time字段)
	Path      string `db:"path" json:"path" info:"文件路径"`
	Ext       string `db:"ext" json:"ext" info:"文件类型,如jpg/mp4等"`
	Type      int8   `db:"type" json:"type" info:"类型;0:本地;1:远程(如cdn)"`
}

func (File) TableName

func (File) TableName() string

type User

type User struct {
	BaseField
	NickName    string `db:"nick_name" json:"nick_name" info:"昵称"`
	Avatar      uint   `db:"avatar" json:"-" info:"头像, 关联file表"`
	Gender      int8   `db:"gender" json:"gender" info:"性别;0:未知;1:男;2:女"`
	PhoneNumber string `db:"phone_number" json:"phoneNumber" info:"手机号"`
	OpenId      string `db:"openid" json:"-" info:"小程序平台的用户识别码"`
	UnionId     string `db:"unionid" json:"-" info:"微信用户识别码"`
	SessionKey  string `db:"session_key" json:"-" info:"微信Session_Key"`
}

func (User) TableName

func (User) TableName() string

type UserTime

type UserTime struct {
	BaseField
	DatingId uint   `db:"dating_id" json:"dating_id" info:"dating表id"`
	UserId   uint   `db:"user_id" json:"user_id" info:"user表id"`
	Info     string `db:"info" json:"info" info:"空闲时间信息;{'t': [[1706978785,1706978785]]}"`
	Status   int8   `db:"status" json:"status" info:"状态; 0:已退出;1:加入"`
}

func (*UserTime) InfoUnmarshal

func (d *UserTime) InfoUnmarshal() *UserTimeInfo

json转结构体

func (UserTime) TableName

func (UserTime) TableName() string

type UserTimeInfo

type UserTimeInfo struct {
	Time [][2]int64 `json:"t"`
}

func (*UserTimeInfo) Marshal

func (u *UserTimeInfo) Marshal() string

结构体转json

Jump to

Keyboard shortcuts

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