db

package
v0.0.0-...-8f4e997 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DB *gorm.DB // nolint:all

Functions

func FollowAction

func FollowAction(ctx context.Context, myID int64, toID int64) error

myID 关注 toID.

func Init

func Init()

func UnFollowAction

func UnFollowAction(ctx context.Context, myID int64, toID int64) error

Types

type Follow

type Follow struct {
	gorm.Model
	ID         int64     `gorm:"column:id;primary_key;AUTO_INCERMENT"`
	FollowTime time.Time `gorm:"column:follow_time;default:CURRENT_TIMESTAMP;NOT NULL"`
	FromUserID int64     `gorm:"column:from_user_id;NOT NULL"`
	ToUserID   int64     `gorm:"column:to_user_id;NOT NULL"`
	CreateTime time.Time `gorm:"column:create_time;default:CURRENT_TIMESTAMP;NOT NULL"`
	UpdateTime time.Time `gorm:"column:create_time;default:CURRENT_TIMESTAMP;NOT NULL"`
}

func (*Follow) TableName

func (u *Follow) TableName() string

type User

type User struct {
	gorm.Model
	ID            int64     `gorm:"column:id;primary_key;AUTO_INCREMENT"`
	CreateTime    time.Time `gorm:"column:create_time;default:CURRENT_TIMESTAMP;NOT NULL"`
	Name          string    `gorm:"column:name;unique;NOT NULL"`
	Password      string    `gorm:"column:password;NOT NULL"`
	Salt          string    `gorm:"column:salt;NOT NULL"`
	FollowCount   int64     `gorm:"column:follow_count;default:0;NOT NULL"`
	FollowerCount int64     `gorm:"column:follower_count;default:0;NOT NULL"`
}

func GetFollowList

func GetFollowList(ctx context.Context, myID int64) ([]*User, error)

func GetFollowerList

func GetFollowerList(ctx context.Context, userID int64) ([]*User, error)

func GetFriendList

func GetFriendList(ctx context.Context, myID int64) ([]*User, error)

func (*User) TableName

func (u *User) TableName() string

Jump to

Keyboard shortcuts

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