model

package
v0.0.0-...-e05a182 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

type Auth struct {
	AccessToken           string    `json:"token" gorm:"-"`
	AuthState             AuthState `json:"authState" gorm:"-"`
	ExpiresIn             int64     `json:"expiresIn" gorm:"-"`
	RefreshToken          string    `json:"refreshToken" gorm:"-"`
	RefreshTokenExpiresIn int64     `json:"refreshTokenExpiresIn" gorm:"-"`
	AccessTokenUUID       string    `json:"-" gorm:"-"`
	RefreshTokenUUID      string    `json:"-" gorm:"-"`
}

type AuthState

type AuthState struct {
	Name string `json:"name"`
	UID  string `json:"uid"`
}

type EmailVerification

type EmailVerification struct {
	UserID string `json:"userId"`
	Email  string `json:"email"`
	Code   string `json:"code"`
}

type Follow

type Follow struct {
	Follower    User
	FollowerID  string `gorm:"primary_key" sql:"type:int not null"`
	Following   User
	FollowingID string `gorm:"primary_key" sql:"type:int not null"`
}

type History

type History struct {
	CreatedAt time.Time `json:"loginTime"`
	UserID    string    `json:"userId"`
	Email     string    `json:"email"`
}

type User

type User struct {
	ID            string `gorm:"primaryKey"`
	CreatedAt     time.Time
	UpdatedAt     time.Time
	DeletedAt     gorm.DeletedAt `gorm:"index"`
	Avatar        string
	Name          string
	Email         string
	Password      string
	Bio           string
	EmailVerified bool
	Followers     []Follow `gorm:"foreignkey:FollowingID"`
	Followings    []Follow `gorm:"foreignkey:FollowerID"`
}

func (*User) BeforeCreate

func (u *User) BeforeCreate(tx *gorm.DB) (err error)

func (*User) FollowedBy

func (u *User) FollowedBy(id string) bool

FollowedBy Followings should be pre loaded

Jump to

Keyboard shortcuts

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