data

package
v0.0.0-...-c291592 Latest Latest
Warning

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

Go to latest
Published: May 29, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UserStatusNormal int = iota
	UserStatusDeleted
)
View Source
const (
	UserCacheExpire = 60 * 60 * 24 // 1 day
)
View Source
const (
	UserMaxFriendCount = 2000 // UserMaxRelationCount is the max count of user relation.
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Friend

type Friend struct {
	ID uint64 `gorm:"primary_key"`
	// UID is the user uid of the user.
	UID types.ID `gorm:"column:uid"`
	// FriendUID is the user uid of the friend.
	FriendUID types.ID `gorm:"column:friend_uid"`
	// Status is the status of the relation.
	Status friendpb.FriendStatus `gorm:"column:status"`
	// CreatedAt is the creation time of the relation.
	CreatedAt int64 `gorm:"column:created_at;autoCreateTime"`
	// UpdatedAt is the update time of the relation.
	UpdatedAt int64 `gorm:"column:updated_at;autoUpdateTime"`
}

Friend is the model of user relation table based on gorm, which is used for user relation management. Friend data stored in mysql.

func (*Friend) IsBlocked

func (ur *Friend) IsBlocked() bool

func (*Friend) IsFriend

func (ur *Friend) IsFriend() bool

func (*Friend) IsStranger

func (ur *Friend) IsStranger() bool

func (*Friend) SetBlocked

func (ur *Friend) SetBlocked() bool

func (*Friend) SetFriend

func (ur *Friend) SetFriend() bool

func (*Friend) SetStatus

func (ur *Friend) SetStatus(status friendpb.FriendStatus) bool

func (*Friend) SetStranger

func (ur *Friend) SetStranger() bool

func (Friend) TableName

func (Friend) TableName() string

func (*Friend) ToProtoFriend

func (ur *Friend) ToProtoFriend() *friendpb.Friend

type FriendRequest

type FriendRequest struct {
	ID        uint64                       `gorm:"primary_key"`
	UID       types.ID                     `gorm:"column:uid"`
	FriendUID types.ID                     `gorm:"column:friend_uid"`
	Status    friendpb.FriendRequestStatus `gorm:"column:status"`
	CreatedAt int64                        `gorm:"column:created_at;autoCreateTime"`
	UpdatedAt int64                        `gorm:"column:updated_at;autoUpdateTime"`
}

FriendRequest is the model of fiend request table based on gorm, which is used for add friend request. FriendRequest data stored in mysql.

func (*FriendRequest) IsAccepted

func (fr *FriendRequest) IsAccepted() bool

func (*FriendRequest) IsRejected

func (fr *FriendRequest) IsRejected() bool

func (*FriendRequest) IsRequested

func (fr *FriendRequest) IsRequested() bool

func (*FriendRequest) SetAccepted

func (fr *FriendRequest) SetAccepted()

func (*FriendRequest) SetRejected

func (fr *FriendRequest) SetRejected()

func (*FriendRequest) SetRequested

func (fr *FriendRequest) SetRequested()

func (*FriendRequest) SetStatus

func (fr *FriendRequest) SetStatus(status friendpb.FriendRequestStatus)

func (FriendRequest) TableName

func (FriendRequest) TableName() string

func (*FriendRequest) ToProto

func (fr *FriendRequest) ToProto() *friendpb.FriendRequest

type Group

type Group struct {
	ID          uint64              `gorm:"primary_key"`
	GID         types.ID            `gorm:"column:gid"`
	Name        string              `gorm:"column:name"`
	Description string              `gorm:"column:description"`
	Avatar      string              `gorm:"column:avatar"`
	MaxMembers  int                 `gorm:"column:max_members"`
	MemberCount int                 `gorm:"column:member_count"`
	Status      grouppb.GroupStatus `gorm:"column:status"`
	OwnerUID    types.ID            `gorm:"column:owner_uid"`
	CreatedAt   int64               `gorm:"column:created_at;autoCreateTime"`
	UpdatedAt   int64               `gorm:"column:updated_at;autoUpdateTime"`
}

Group is the model of group table based on gorm, which contains group basic info. Group data stored in mysql.

func (*Group) IsSilent

func (g *Group) IsSilent() bool

func (Group) TableName

func (Group) TableName() string

func (*Group) ToProto

func (g *Group) ToProto() *grouppb.Group

type GroupMember

type GroupMember struct {
	ID        uint64                     `gorm:"primary_key"`
	GID       types.ID                   `gorm:"column:gid"`
	UID       types.ID                   `gorm:"column:uid"`
	Type      grouppb.GroupMember_Type   `gorm:"column:type"`
	Status    grouppb.GroupMember_Status `gorm:"column:status"`
	CreatedAt int64                      `gorm:"column:created_at;autoCreateTime"`
	UpdatedAt int64                      `gorm:"column:updated_at;autoUpdateTime"`
}

GroupMember is the model of group_member table based on gorm, which contains group member info. GroupMember data stored in mysql.

func (GroupMember) TableName

func (GroupMember) TableName() string

func (*GroupMember) ToProto

func (g *GroupMember) ToProto() *grouppb.GroupMember

type User

type User struct {
	ID        uint64   `gorm:"primary_key"`
	UID       types.ID `gorm:"column:uid"`
	Name      string   `gorm:"column:name"`
	Password  string   `gorm:"column:password"`
	Email     *string  `gorm:"column:email"`
	Phone     *string  `gorm:"column:phone"`
	Avatar    string   `gorm:"column:avatar"`
	Status    int      `gorm:"column:status"`
	CreatedAt int64    `gorm:"column:created_at;autoCreateTime"`
	UpdatedAt int64    `gorm:"column:updated_at;autoUpdateTime"`
}

User is the model of user table based on gorm, which contains user basic info. User data stored in mysql.

func (*User) IsDeleted

func (u *User) IsDeleted() bool

func (*User) SetEmail

func (u *User) SetEmail(email string)

func (*User) SetPhone

func (u *User) SetPhone(phone string)

func (User) TableName

func (User) TableName() string

func (*User) ToProto

func (u *User) ToProto() *userv1.User

Jump to

Keyboard shortcuts

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