Documentation ¶
Index ¶
- Constants
- func AppendHTML(template, pattern string) (string, error)
- func AppendObj(body interface{}, name, pattern string) (string, error)
- func AppendPage(body interface{}, name, pattern string) error
- func CheckPanic(err error)
- func DeleteHTML(template, pattern string) (string, error)
- func DeleteObj(body interface{}, name, pattern string) (string, error)
- func DeletePage(body interface{}, name, pattern string) error
- func Err(text string) error
- func Errs(text string, err error) error
- func IsDir(dir string) (bool, error)
- func IsFile(name string) (bool, error)
- func ReadHTML(name string) (string, error)
- func ReadLog(logName string) (string, error)
- func ReplaceHTML(template string, num int, pattern string) (string, error)
- func ReplacePattern(pattern string, body interface{}) (string, error)
- func SaveHTML(name, html string) error
- func WriteLog(logger *log.Logger, logName string, logInfo interface{})
- func WriteLogFunc(logger *log.Logger, logName string, logFunc LogActCallback)
- type CookieFunction
- type CookieUtils
- type LogActCallback
- type LogFunction
Constants ¶
const ( CookieSession string = "SessionID" CookieToken string = "Token" )
const value for global use
Variables ¶
This section is empty.
Functions ¶
func AppendHTML ¶
AppendHTML append content the symbol is <!-- {{{ }}} -->
func AppendPage ¶
AppendPage update html after append a obj
func DeleteHTML ¶
DeleteHTML delete obj by pattern to string
func DeletePage ¶
DeletePage delete a obj in html
func ReplaceHTML ¶
ReplaceHTML check replace template
func ReplacePattern ¶
ReplacePattern replace {{{ num }}} in pattern by struct
func WriteLogFunc ¶
func WriteLogFunc(logger *log.Logger, logName string, logFunc LogActCallback)
WriteLogFunc write into log by func
Types ¶
type CookieFunction ¶
type CookieFunction interface { NewCookie() SetSession() SetToken() IsSession() IsToken() }
CookieFunction define cookie
type CookieUtils ¶
type CookieUtils struct { *sync.RWMutex // Read & Write locker // contains filtered or unexported fields }
CookieUtils keep date in memory
func NewCookie ¶
func NewCookie(defaultExpiration time.Duration) *CookieUtils
NewCookie create new in memory cookie storage save Cookie by default time
func (*CookieUtils) IsSession ¶
func (c *CookieUtils) IsSession(sessionID string) bool
IsSession check sessionID
func (*CookieUtils) IsToken ¶
func (c *CookieUtils) IsToken(token string) bool
IsToken check if is token then delete it
func (*CookieUtils) SetSession ¶
func (c *CookieUtils) SetSession() string
SetSession generate client uuid and store in memory return session for setting cookie
func (*CookieUtils) SetToken ¶
func (c *CookieUtils) SetToken() string
SetToken set token, use once only return token for setting cookie
type LogFunction ¶
type LogFunction interface { // write log WriteLog() // write log by extra func WriteLogFunc() // read log ReadLog() }
LogFunction for doing log action