Documentation ¶
Index ¶
- Constants
- Variables
- func Auth(secret string) gin.HandlerFunc
- func Connect()
- func Copy(toValue interface{}, fromValue interface{}) (err error)
- func CreateHash(input string) string
- func Domain(input string) string
- func DownloadFile(url, path string) error
- func GenerateToken(payload map[string]interface{}, expireHour time.Duration, issuer string) (string, error)
- func GetClaims(tokenString string) (jwt.MapClaims, error)
- func GetJSON(url string, target interface{}) error
- func Jsonify(jsonString string) ([]map[string]interface{}, error)
- func RBAC(accessLevel int) gin.HandlerFunc
- func Restart()
- func SearchFile(pathS, fileName, ext string) []string
- func SendMail(body, subject string, dest, data map[string]string)
- func UniqueInterface(list *[]interface{})
- func Unzip(src, dest string) error
- type ArchiveWriteFunc
- type Archivex
- type NullBool
- type NullFloat64
- type NullInt64
- type NullString
- type NullTime
- type Payload
- type ZipFile
- func (z *ZipFile) Add(name string, file []byte) error
- func (z *ZipFile) AddAll(dir string, includeCurrentFolder bool) error
- func (z *ZipFile) AddFile(name string) error
- func (z *ZipFile) AddFileWithName(name string, filepath string) error
- func (z *ZipFile) Close() error
- func (z *ZipFile) Create(name string) error
Constants ¶
const ( /*AdminAL used as admin access level*/ AdminAL = 10 /*UserAL used as user access level*/ UserAL = 1 )
Variables ¶
var DB *dbx.DB
DB used as object to communicate with sqlite
Functions ¶
func GenerateToken ¶
func GenerateToken(payload map[string]interface{}, expireHour time.Duration, issuer string) (string, error)
GenerateToken used for generate JWT token
func SearchFile ¶
SearchFile used for search file on directory
func UniqueInterface ¶
func UniqueInterface(list *[]interface{})
UniqueInterface used for remove duplicate from slice of interface
Types ¶
type ArchiveWriteFunc ¶
ArchiveWriteFunc is the closure used by an archive's AddAll method to actually put a file into an archive Note that for directory entries, this func will be called with a nil 'file' param
type Archivex ¶
type Archivex interface { Create(name string) error Add(name string, file []byte) error AddFile(name string) error AddAll(dir string, includeCurrentFolder bool) error Close() error }
Archivex used as archiever object
type NullBool ¶
NullBool is a type that can be null or a bool
func (NullBool) MarshalJSON ¶
MarshalJSON correctly serializes a NullBool to JSON
func (*NullBool) UnmarshalJSON ¶
UnmarshalJSON correctly deserializes a NullBool from JSON
type NullFloat64 ¶
type NullFloat64 struct {
sql.NullFloat64
}
NullFloat64 is a type that can be null or a float64
func (NullFloat64) MarshalJSON ¶
func (n NullFloat64) MarshalJSON() ([]byte, error)
MarshalJSON correctly serializes a NullFloat64 to JSON
func (*NullFloat64) UnmarshalJSON ¶
func (n *NullFloat64) UnmarshalJSON(b []byte) error
UnmarshalJSON correctly deserializes a NullFloat64 from JSON
type NullInt64 ¶
NullInt64 is a type that can be null or an int
func (NullInt64) MarshalJSON ¶
MarshalJSON correctly serializes a NullInt64 to JSON
func (*NullInt64) UnmarshalJSON ¶
UnmarshalJSON correctly deserializes a NullInt64 from JSON
type NullString ¶
type NullString struct {
sql.NullString
}
NullString is a type that can be null or a string
func (NullString) MarshalJSON ¶
func (n NullString) MarshalJSON() ([]byte, error)
MarshalJSON correctly serializes a NullString to JSON
func (*NullString) UnmarshalJSON ¶
func (n *NullString) UnmarshalJSON(b []byte) error
UnmarshalJSON correctly deserializes a NullString from JSON
type NullTime ¶
NullTime is a type that can be null or a time
func (NullTime) MarshalJSON ¶
MarshalJSON correctly serializes a NullTime to JSON
func (*NullTime) UnmarshalJSON ¶
UnmarshalJSON correctly deserializes a NullTime from JSON
type Payload ¶
type Payload struct { Iat int `json:"iat"` Exp int `json:"exp"` Iss string `json:"iss"` Sub string `json:"sub"` ID int `json:"id"` Name string `json:"name"` EmailAddress string `json:"email_address"` LastLoggedIn int `json:"last_logged_in"` AccessLevel int `json:"access_level"` }
Payload used for encode/decode token
type ZipFile ¶
ZipFile implement *zip.Writer
func (*ZipFile) AddAll ¶
AddAll adds all files from dir in archive, recursively. Directories receive a zero-size entry in the archive, with a trailing slash in the header name, and no compression
func (*ZipFile) AddFileWithName ¶
AddFileWithName add a file to zip with a name