Documentation ¶
Index ¶
- func BCryptPassword(pwdWithSalt string) string
- func GenerateJwtAuthToken(claims *PayloadClaims) (string, error)
- func RandomString(strLen int) string
- func ValidateParams(c *gin.Context, params ...string) []gin.H
- func ValidatePostFromParams(c *gin.Context, params ...string) []gin.H
- func VerifyingPassword(crypt, pwdWithSalt string) bool
- type Channel
- type Model
- type Payload
- type PayloadClaims
- type Reply
- type Thread
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateJwtAuthToken ¶
func GenerateJwtAuthToken(claims *PayloadClaims) (string, error)
GenerateJwtAuthToken generate a new jwtAuthToken
func ValidateParams ¶
ValidateParams 校验参数from c.Param 不能为空
func ValidatePostFromParams ¶
ValidatePostFromParams 校验参数from c.PostForm不能为空
func VerifyingPassword ¶
VerifyingPassword Verifying Password
Types ¶
type Channel ¶
type Channel struct { Model Name string `gorm:"not null" json:"name"` Slug string `gorm:"not null"` }
Channel mode
type Model ¶
type Model struct { ID uint `gorm:"primary_key" json:"id"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
Model rewrite gorm model
type Payload ¶
Payload data
func CheckWebSocketToken ¶
CheckWebSocketToken validate user jwtToken from websocket
func ValidateAuthToken ¶
ValidateAuthToken validate user jwtToken
type PayloadClaims ¶
type PayloadClaims struct { Data Payload `json:"data"` jwt.StandardClaims }
PayloadClaims data
type Reply ¶
type Reply struct { Model ThreadID uint UserID uint `gorm:"not null" json:"user_id"` User User Body string }
Reply model
type Thread ¶
type Thread struct { Model UserID uint `gorm:"not null" json:"user_id"` User User Replies []Reply ChannelID uint `gorm:"not null" json:"channel_id"` RepliesCount uint `json:"replies_count"` Title string `gorm:"not null" json:"title"` Body string `gorm:"not null;type:text" json:"body"` }
Thread model
Click to show internal directories.
Click to hide internal directories.