Documentation ¶
Overview ¶
***************************************** *FileName: file.go *Author: Liu han *Date: 2017-11-24 *Description: File Read & Write Tool ******************************************
Index ¶
- Constants
- Variables
- func AppendBytes(filename string, content []byte) error
- func AppendString(filename string, content string) error
- func DeleteFile(filename string) bool
- func DeleteSession(w http.ResponseWriter, r *http.Request)
- func GetMd5String(s string) string
- func GetUUID() string
- func GetUsername(r *http.Request) string
- func HasSession(r *http.Request) bool
- func IsFileExist(filename string) bool
- func Mkdir(filename string) error
- func Mkfile(filename string) error
- func OverwriteBytes(filename string, content []byte) error
- func OverwriteString(filename string, content string) error
- func ReadBytes(filename string) ([]byte, error)
- func ReadString(filename string) (string, error)
- func SetSession(session Session, w http.ResponseWriter)
- type CSV
- type Config
- func (c *Config) Bool(key string) (bool, error)
- func (c *Config) DefaultBool(key string, defaultval bool) bool
- func (c *Config) DefaultFloat(key string, defaultval float64) float64
- func (c *Config) DefaultInt(key string, defaultval int) int
- func (c *Config) DefaultInt64(key string, defaultval int64) int64
- func (c *Config) DefaultString(key string, defaultval string) string
- func (c *Config) DefaultStrings(key string, defaultval []string) []string
- func (c *Config) Float(key string) (float64, error)
- func (c *Config) Int(key string) (int, error)
- func (c *Config) Int64(key string) (int64, error)
- func (c *Config) Prase() error
- func (c *Config) String(key string) string
- func (c *Config) Strings(key string) []string
- type ConfigInterface
- type Key
- type Line
- type Session
Constants ¶
View Source
const ( USERNAME = "username" VIEW = "view" ID = "id" )
Variables ¶
View Source
var ConfigFile = "./conf/app.conf"
View Source
var SESSION_MAP = map[string]Session{}
Functions ¶
func AppendBytes ¶
func AppendString ¶
func DeleteFile ¶
func DeleteSession ¶
func DeleteSession(w http.ResponseWriter, r *http.Request)
func GetUsername ¶
func HasSession ¶
func IsFileExist ¶
func OverwriteBytes ¶
func OverwriteString ¶
func ReadString ¶
func SetSession ¶
func SetSession(session Session, w http.ResponseWriter)
Types ¶
type Config ¶
func (*Config) DefaultStrings ¶
type ConfigInterface ¶
type ConfigInterface interface { //Set(key, val string) error // support section::key type in given key when using ini type. String(key string) string // support section::key type in key string when using ini and json type; Int,Int64,Bool,Float,DIY are same. Strings(key string) []string //get string slice Int(key string) (int, error) Int64(key string) (int64, error) Bool(key string) (bool, error) Float(key string) (float64, error) DefaultString(key string, defaultval string) string // support section::key type in key string when using ini and json type; Int,Int64,Bool,Float,DIY are same. DefaultStrings(key string, defaultval []string) []string //get string slice DefaultInt(key string, defaultval int) int DefaultInt64(key string, defaultval int64) int64 DefaultBool(key string, defaultval bool) bool DefaultFloat(key string, defaultval float64) float64 }
var AppConfig ConfigInterface
Click to show internal directories.
Click to hide internal directories.