2024-02-11 01:31:01 +08:00
|
|
|
|
package types
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"time"
|
|
|
|
|
|
|
|
|
|
"gorm.io/gorm"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type (
|
|
|
|
|
|
|
|
|
|
// sql options
|
|
|
|
|
SqlOptions struct {
|
|
|
|
|
MaxIdleConns int
|
|
|
|
|
MaxOpenConns int
|
|
|
|
|
ConnMaxLifetime time.Duration
|
|
|
|
|
|
|
|
|
|
LogStdout bool
|
|
|
|
|
Debug bool
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// standard ID,Created,Updated,Deleted definition.
|
|
|
|
|
Std_IICUDS struct {
|
2024-07-02 11:01:37 +08:00
|
|
|
|
ID uint `gorm:"primarykey;" json:"id"`
|
|
|
|
|
Identity string `gorm:"column:identity;type:varchar(36);uniqueIndex;" json:"identity"` // 唯一标识,24位NanoID,36位为UUID
|
|
|
|
|
CreatedAt time.Time `json:"created_at"`
|
|
|
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
|
|
|
DeletedAt gorm.DeletedAt `gorm:"index;" json:"deleted_at"`
|
|
|
|
|
Status int8 `gorm:"default:0;index;" json:"status"` // 状态:默认为0,-1禁止,1为正常
|
2024-02-11 01:31:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// standard ID,Identity,Created,Updated,Deleted,Status definition.
|
|
|
|
|
Std_ICUD struct {
|
2024-07-02 11:01:37 +08:00
|
|
|
|
ID uint `gorm:"primarykey;" json:"id"`
|
|
|
|
|
CreatedAt time.Time `json:"created_at"`
|
|
|
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
|
|
|
DeletedAt gorm.DeletedAt `gorm:"index;" json:"deleted_at"`
|
2024-02-11 01:31:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// standard ID,Created definition.
|
|
|
|
|
Std_IdCreated struct {
|
2024-07-02 11:01:37 +08:00
|
|
|
|
ID uint `gorm:"primarykey;" json:"id"`
|
|
|
|
|
CreatedAt time.Time `json:"created_at"`
|
2024-02-11 01:31:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// standard PassportID,PassportIdentity definition.
|
|
|
|
|
Std_Passport struct {
|
2024-07-02 11:01:37 +08:00
|
|
|
|
PassportID uint `gorm:"column:passport_id;Index;" json:"passport_id"`
|
|
|
|
|
PassportIdentity string `gorm:"column:passport_identity;type:varchar(36);Index;" json:"passport_identity"` // 用户唯一标识,24位NanoID,36位为UUID
|
2024-02-11 01:31:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// standard ID definition.
|
|
|
|
|
Std_ID struct {
|
2024-07-02 11:01:37 +08:00
|
|
|
|
ID uint `gorm:"primarykey;" json:"id"`
|
2024-02-11 01:31:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// standard Identity definition.
|
|
|
|
|
Std_Identity struct {
|
2024-07-02 11:01:37 +08:00
|
|
|
|
Identity string `gorm:"column:identity;type:varchar(36);uniqueIndex;" json:"identity"` // 唯一标识,24位NanoID,36位为UUID
|
2024-02-11 01:31:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// standard Status definition.
|
|
|
|
|
Std_Status struct {
|
2024-07-02 11:01:37 +08:00
|
|
|
|
Status int8 `gorm:"default:0;index;" json:"status"` // 状态:默认为0,-1禁止,1为正常
|
2024-02-11 01:31:01 +08:00
|
|
|
|
}
|
|
|
|
|
)
|