Documentation
¶
Index ¶
- Constants
- Variables
- func BodyDump(ignore ...string) echo.MiddlewareFunc
- func CheckFileExists(name string) bool
- func ConvertType(sourceValue any, targetType reflect.Type) (any, error)
- func CopyFile(infile, outfile string) error
- func CopyMap[K comparable, V any](src map[K]V) map[K]V
- func CreateFormFile(fieldname, filename string) textproto.MIMEHeader
- func ExecCommand(dir string, name string, flags ...string) (out []byte, err error)
- func GenerateGJWToken(password, deviceid, userid, issuer string, roles []string, ...) (string, error)
- func GenerateGJWTokenWithTime(password string, deviceid string, userid string, issuer string, roles []string, ...) (string, error)
- func GenerateServerToken(password, systemid, userid, issuer string, roles []string, ...) (string, error)
- func GenerateServerTokenWithTime(password string, systemid string, userid string, issuer string, roles []string, ...) (string, error)
- func GetContentType(ext string) string
- func GetFileName(file string) string
- func GetFileSize(name string) (int64, error)
- func GetHeader(depth int) string
- func GetStreamUUID() (string, error)
- func GetStringSignature(src string, key string, length int) string
- func GetStructJSON(v interface{}) string
- func GetSysLogLevel() int
- func GetTempFileName(tempFolder string, pattern string) (string, error)
- func GetUUID() (string, error)
- func GetWorkFolder(jobId string, rootPath string, create bool) (string, error)
- func HTTPDeleteFile(url string) ([]byte, error)
- func HTTPGetFile(url string, file string) error
- func HTTPGetRequest(url string) ([]byte, error)
- func HTTPGetRequestAuth(url string, token string) ([]byte, error)
- func HTTPGetRequestInternal(url string, headers *map[string]string) ([]byte, error)
- func HTTPPostRequest(url string, contentType string, post []byte) ([]byte, int, error)
- func HTTPPostRequestAuth(url string, contentType string, post []byte, token string) ([]byte, int, error)
- func HTTPPostRequestInternal(url string, contentType string, post []byte, timeout int, ...) ([]byte, int, error)
- func HTTPUploadFile(filename, url string, fieldname string) ([]byte, error)
- func ImplementsInterface(target reflect.Type, theInterface reflect.Type) bool
- func InitLogFile(logowner string, minversion string, folder string) (*os.File, error)
- func IsArrayType(target reflect.Type) bool
- func IsConvertible(sourceValue any, targetType reflect.Type) bool
- func IsEmptyStr(target *string) bool
- func IsErrorObj(target interface{}) bool
- func IsErrorType(target reflect.Type) bool
- func IsFuncType(target reflect.Type) bool
- func IsInterfaceType(target reflect.Type) bool
- func IsPointerType(target reflect.Type) bool
- func IsStructType(target reflect.Type) bool
- func IsValidID(id string) bool
- func IsValidRole(role string) bool
- func IsValidStreamUUID(id string) bool
- func IsValidURL(urlstr string) bool
- func IsValidUUID(uuid string) bool
- func LoadServerKey(certfile, certkey, certca string) (*http.Server, error)
- func LogWithLevel(level int, loggeronly bool, v ...interface{})
- func LogWithLevelJSON(level int, logger bool, v interface{})
- func NewNameSameExt(oldFilePathWithExt string, newFileNameNoExt string) string
- func PostRequest(url string, request interface{}) (string, int, error)
- func PostRequestAuth(url string, request interface{}, token string) (string, int, error)
- func RandStringAlphaNums(n int) string
- func RandStringLetters(n int) string
- func ReadFile(filename string) ([]byte, error)
- func SetLogLevelEnvName(name string)
- func StdOutFormat(v ...interface{})
- func StdOutFormatWithLevel(level int, v ...interface{})
- func StringInSlice(a string, list []string) bool
- func ToPtr[T interface{}](source T) *T
- func Unused(_ ...interface{})
- func WriteFile(filename string, data []byte) error
- type ApiError
- type GJWCustomClaims
- type GJWTokenPayload
- type Logger
- func (log *Logger) Debug(v ...interface{})
- func (log *Logger) Error(v ...interface{})
- func (log *Logger) FDebug(v ...interface{})
- func (log *Logger) FError(v ...interface{})
- func (log *Logger) FFatal(v ...interface{})
- func (log *Logger) FInfo(v ...interface{})
- func (log *Logger) FWarn(v ...interface{})
- func (log *Logger) Fatal(v ...interface{})
- func (log *Logger) Info(v ...interface{})
- func (log *Logger) Warn(v ...interface{})
- type RequestContext
- func (this *RequestContext) DbTx() *gorm.DB
- func (this *RequestContext) GetContext() context.Context
- func (this *RequestContext) GoContext() context.Context
- func (this *RequestContext) TODO() *RequestContext
- func (this *RequestContext) WithDbTx(tx *gorm.DB) *RequestContext
- func (this *RequestContext) WithGoContext(ctx context.Context) *RequestContext
- type ServerCustomClaims
- type ServerTokenPayload
Constants ¶
View Source
const ( LOG_LEVEL_WARN int = 0 LOG_LEVEL_INFO int = 1 LOG_LEVEL_DEBUG int = 2 LOG_LEVEL_TRACE int = 3 LOG_LEVEL_ERROR int = -1 LOG_LEVEL_FATAL int = -2 )
View Source
const DEFAULT_DIRECTORY_PERMISSION = 0775
View Source
const DEFAULT_FILE_PERMISSION = 0664
View Source
const HASH_KEY = "CDKCloud."
Variables ¶
View Source
var LogFileInitialized = false
View Source
var LogLevel = map[string]int{
"WARN": 0,
"INFO": 1,
"DEBUG": 2,
"TRACE": 3,
"ERROR": -1,
"FATAL": -2,
}
View Source
var LogLevelEnvName = "LOG_LEVEL"
View Source
var LogLevelName = map[int]string{
0: "WARN",
1: "INFO",
2: "DEBUG",
3: "TRACE",
-1: "ERROR",
-2: "FATAL",
}
View Source
var ServerToken = ""
Functions ¶
func BodyDump ¶
func BodyDump(ignore ...string) echo.MiddlewareFunc
func CheckFileExists ¶
func CopyMap ¶
func CopyMap[K comparable, V any](src map[K]V) map[K]V
CopyMap returns a shallow copy of src. Returns nil if src is nil.
func CreateFormFile ¶
func CreateFormFile(fieldname, filename string) textproto.MIMEHeader
Set the Content-Type of upload file.
func ExecCommand ¶
func GenerateGJWToken ¶
func GenerateServerToken ¶
func GetContentType ¶
func GetFileName ¶
func GetFileSize ¶
func GetStreamUUID ¶
func GetStructJSON ¶
func GetStructJSON(v interface{}) string
func GetSysLogLevel ¶
func GetSysLogLevel() int
func HTTPDeleteFile ¶
func HTTPGetFile ¶
func HTTPGetRequest ¶
func HTTPGetRequestInternal ¶
func HTTPPostRequest ¶
func HTTPPostRequestAuth ¶
func HTTPPostRequestInternal ¶
func ImplementsInterface ¶
func InitLogFile ¶
func IsArrayType ¶
func IsEmptyStr ¶
func IsErrorObj ¶
func IsErrorObj(target interface{}) bool
func IsErrorType ¶
func IsFuncType ¶
func IsInterfaceType ¶
func IsPointerType ¶
func IsStructType ¶
func IsValidRole ¶
func IsValidStreamUUID ¶
func IsValidURL ¶
func IsValidUUID ¶
func LogWithLevel ¶
func LogWithLevelJSON ¶
func NewNameSameExt ¶
func PostRequestAuth ¶
func RandStringAlphaNums ¶
func RandStringLetters ¶
func SetLogLevelEnvName ¶
func SetLogLevelEnvName(name string)
func StdOutFormat ¶
func StdOutFormat(v ...interface{})
func StdOutFormatWithLevel ¶
func StdOutFormatWithLevel(level int, v ...interface{})
func StringInSlice ¶
Types ¶
type GJWCustomClaims ¶
type GJWCustomClaims struct {
UserId string `json:"userid,omitempty"`
DId string `json:"did,omitempty"`
Roles []string `json:"roles"`
jwt.RegisteredClaims
}
type GJWTokenPayload ¶
type GJWTokenPayload struct {
UserId string `json:"userid,omitempty"`
DId string `json:"did,omitempty"`
Roles []string `json:"roles"`
}
func ParseGJWToken ¶
func ParseGJWToken(tokenString string, password string) (*GJWTokenPayload, error)
type RequestContext ¶
type RequestContext struct {
// contains filtered or unexported fields
}
func NewRequestContext ¶
func NewRequestContext() *RequestContext
func (*RequestContext) DbTx ¶
func (this *RequestContext) DbTx() *gorm.DB
func (*RequestContext) GetContext ¶
func (this *RequestContext) GetContext() context.Context
func (*RequestContext) GoContext ¶
func (this *RequestContext) GoContext() context.Context
func (*RequestContext) TODO ¶
func (this *RequestContext) TODO() *RequestContext
func (*RequestContext) WithDbTx ¶
func (this *RequestContext) WithDbTx(tx *gorm.DB) *RequestContext
func (*RequestContext) WithGoContext ¶
func (this *RequestContext) WithGoContext(ctx context.Context) *RequestContext
type ServerCustomClaims ¶
type ServerCustomClaims struct {
SystemId string `json:"systemid"`
UserId string `json:"userid"`
Roles []string `json:"roles"`
jwt.RegisteredClaims
}
type ServerTokenPayload ¶
Click to show internal directories.
Click to hide internal directories.