Documentation ¶
Index ¶
- Constants
- Variables
- func Base64ToString(v string) (c string, err error)
- func GenUUID() string
- func GetGormLogLevel() logger.LogLevel
- func IsDuplicateKeyErr(err error) bool
- func IsForeignKeyErr(err error) bool
- func NewTokenCert(str string) *string
- func ParseUUID(uuidStr string) (uuid.UUID, error)
- func PrintPromptInfo(message ...string)
- func PrintPromptWarning(message ...string)
- func PublicFlag(tagVer string, goVer string, timeVer string)
- func PublicServerFlag()
- func PublicVersion()
- func ReadTokenFromMetadata(md metadata.MD) (string, error)
- func SprintPromptInfo(message ...string) string
- func SprintPromptWarning(message ...string) string
- func StartPPOFDebug(server http.Server, showHelp bool)
- func StringToBase64(v string) (c string)
- func StringToMD5(v string) (c string)
- func StringToSha1(v string) (c string)
- func StringToSha256(v string) (c string)
- func StringToSha512(v string) (c string)
- func TimestampToUTC8String(timestamp int64) string
- func TimestampToUTCString(timestamp int64) string
- func UTC8StringToTimestamp(str string) (int64, error)
- func UTCStringToTimestamp(str string) (int64, error)
- func VerifyToken(v string, tokenCert *string) error
- type Logger
- type Token
Constants ¶
View Source
const ( ResponseStatusCodeSuccess = 0 ResponseStatusCodeServerError = 1 ResponseStatusCodeNotAuth = 2 ResponseStatusCodeFieldTypeError = 3 ResponseStatusCodeOtherError = -1 )
View Source
const ( UserTypeTeacher = 1 UserTypeStudent = 2 )
View Source
const ( UserGenderMan = 1 UserGenderWoman = 2 UserGenderOther = -1 )
View Source
const ( QuestionLevelBasic = 0 QuestionLevelNormal = 1 QuestionLevelDifficult = 2 QuestionLevelChallenging = 3 )
View Source
const ( QuestionTypeSingle = 0 QuestionTypeMultiple = 1 QuestionTypeJudge = 2 )
View Source
const ( FileTypeJPG = iota FileTypePNG FileTypePPT FileTypeXLS FileTypeDOC FileTypePPTX FileTypeXLSX FileTypeDOCX FileTypePDF FileTypeMP3 FileTypeMP4 FileTypeZIP )
View Source
const ( LogDebug int = iota LogInfo LogWarning LogError )
View Source
const DefTokenCert string = "96be053dab04"
View Source
const DefaultPassword = "1234567890"
View Source
const TokenCookieName = "AuthToken"
View Source
const TokenHeader string = "3c6b9fc1"
View Source
const TokenSplitCharacter string = "."
Variables ¶
View Source
var ( FlagHelp bool FlagVersion bool FlagUseSqlite bool FlagUsePG bool FlagSqliteDB string FlagPgAddr string FlagPgPort int FlagPgDB string FlagPgUser string FlagPgPassword string FlagPgSSLMode string FlagPgSSLCert string FlagPgSSLKey string FlagPgSSLRootCert string FlagLogLevel int )
View Source
var ( BuildTag string BuildGo string BuildTime string )
Functions ¶
func Base64ToString ¶
func GetGormLogLevel ¶ added in v0.7.0
func IsDuplicateKeyErr ¶ added in v0.7.0
IsDuplicateKeyErr 返回是否为重复的唯一约束错误, 一般用于 Create, 仅适用于 PostgreSQL
func IsForeignKeyErr ¶ added in v0.7.0
IsForeignKeyErr 返回是否为外键要关联的记录不存在错误, 仅适用于 PostgreSQL
func NewTokenCert ¶
func PrintPromptInfo ¶ added in v0.6.7
func PrintPromptInfo(message ...string)
func PrintPromptWarning ¶ added in v0.6.7
func PrintPromptWarning(message ...string)
func PublicFlag ¶ added in v0.2.0
func PublicServerFlag ¶ added in v0.4.0
func PublicServerFlag()
func PublicVersion ¶ added in v0.4.0
func PublicVersion()
func ReadTokenFromMetadata ¶ added in v0.7.0
func SprintPromptInfo ¶ added in v0.6.7
func SprintPromptWarning ¶ added in v0.6.7
func StartPPOFDebug ¶
func StringToBase64 ¶
func TimestampToUTC8String ¶
func TimestampToUTCString ¶
func UTC8StringToTimestamp ¶
func UTCStringToTimestamp ¶
func VerifyToken ¶
Types ¶
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
func (*Logger) Print ¶ added in v0.1.1
func (logger *Logger) Print(values ...interface{})
Print: Interface for GORM debug log
type Token ¶
type Token struct { Timestamp int64 `json:"timestamp"` LifeCycle int64 `json:"lifeCycle"` AccountID uint32 `json:"accountID"` Name string `json:"name"` Gender int32 `json:"gender"` Type int32 `json:"type"` IsManager bool `json:"isManager"` }
func UnpackTokenFromMetadata ¶ added in v0.7.0
Source Files ¶
Click to show internal directories.
Click to hide internal directories.