Documentation
¶
Index ¶
- func Asset(name string) ([]byte, error)
- func AssetDir(name string) ([]string, error)
- func AssetInfo(name string) (os.FileInfo, error)
- func AssetNames() []string
- func CutKey(key string) string
- func Datestr2ch(epoch int64) string
- func EachFiles(dir string, handler func(dir os.FileInfo) error) error
- func EachIOLine(f io.ReadCloser, handler func(line string, num int) error) error
- func EachKeyValueLine(path string, handler func(key string, value []string, num int) error) error
- func EachLine(path string, handler func(line string, num int) error) error
- func EmbedURL(url string) string
- func Emoji(str string) string
- func Escape(msg string) string
- func EscapeSpace(msg string) string
- func Fclose(f io.Closer)
- func FileDecode(query string) string
- func FileEncode(t, query string) string
- func FileHash(query string) string
- func FileSize(path string) int64
- func FindString(s []string, val string) int
- func FromSJIS(b string) string
- func GetBoard(url string) string
- func HasExt(fname, suffix string) bool
- func HasString(s []string, val string) bool
- func IsDir(path string) bool
- func IsFile(path string) bool
- func IsValidImage(mimetype, path string) bool
- func MD5digest(dat string) string
- func MakeThumbnail(encoded []byte, suffix, thumbnailSize string) []byte
- func MoveFile(src, dst string) error
- func MustAsset(name string) []byte
- func RegistToRouter(s *mux.Router, path string, fn func(w http.ResponseWriter, r *http.Request))
- func RestoreAsset(dir, name string) error
- func RestoreAssets(dir, name string) error
- func Shuffle(slc Shufflable)
- func StrDecode(query string) string
- func StrEncode(query string) string
- func ToSJIS(b string) string
- func Verify(mesg, testsig, publicKey string) bool
- func WriteFile(path, data string) error
- func WriteMap(path string, ary map[string][]string) error
- func WriteSlice(path string, ary []string) error
- type ConfList
- type Htemplate
- type PrivateKey
- type RegexpList
- type Shufflable
- type Ttemplate
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Asset ¶ added in v0.0.3
Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.
func AssetDir ¶ added in v0.0.3
AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:
data/ foo.txt img/ a.png b.png
then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.
func AssetInfo ¶ added in v0.0.3
AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.
func AssetNames ¶ added in v0.0.3
func AssetNames() []string
AssetNames returns the names of the assets.
func Datestr2ch ¶
Datestr2ch converts unixtime str ecpochStr to the certain format string. e.g. 2006/01/02(日) 15:04:05.99
func EachIOLine ¶
EachIOLine iterates each line to a ReadCloser ,calls func and close f.
func EachKeyValueLine ¶
EachKeyValueLine calls func for each line which contains key and value separated with "<>"
func FileEncode ¶
FileEncode encodes filename.
>>> file_encode('foo', 'a') 'foo_61' >>> file_encode('foo', '~') 'foo_7E'
func FileHash ¶
FileHash simply returns itself, because it does not implement other types except 'asis'.
func FindString ¶
FindString search the val in ary and returns index. it returns -1 if not found.
func IsValidImage ¶
IsValidImage checks type of path is same as mimetype or not.
func MakeThumbnail ¶
MakeThumbnail makes thumbnail to suffix image format with thumbnailSize.
func MustAsset ¶ added in v0.0.3
MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.
func RegistToRouter ¶
RegistToRouter registers fn to s with path and returns the handler.
func RestoreAsset ¶ added in v0.0.3
RestoreAsset restores an asset under the given directory
func RestoreAssets ¶ added in v0.0.3
RestoreAssets restores an asset under the given directory recursively
func WriteSlice ¶
WriteSlice write ary into a path.
Types ¶
type ConfList ¶
type ConfList struct {
// contains filtered or unexported fields
}
ConfList represents regexp list.
One regexp per one line.
func NewConfList ¶
NewConfList makes a confList instance from path.
func (*ConfList) GetSplitData ¶ added in v0.0.12
GetSplitData retuns a copy of splitted lines by ", " in the file.
type Htemplate ¶
type Htemplate struct {
*htmlTemplate.Template
}
Htemplate is for rendering html stuff.
func NewHtemplate ¶
NewHtemplate adds funcmap to template var and parse files.
func (*Htemplate) ExecuteTemplate ¶
ExecuteTemplate executes template and returns it as string.
type PrivateKey ¶
type PrivateKey struct {
// contains filtered or unexported fields
}
PrivateKey reppresents private key,
func MakePrivateKey ¶
func MakePrivateKey(keystr string) *PrivateKey
MakePrivateKey makes privatekey from keystr
func (*PrivateKey) GetKeys ¶
func (p *PrivateKey) GetKeys() (string, string)
GetKeys returns base64 encoded private key
type RegexpList ¶
type RegexpList struct { *ConfList // contains filtered or unexported fields }
RegexpList represents RegExp list.
One regexp per one line.
func NewRegexpList ¶
func NewRegexpList(path string) *RegexpList
NewRegexpList makes a regexpList and regexp.comples each lines in the file.
func (*RegexpList) Check ¶
func (r *RegexpList) Check(target string) bool
Check returns true if target matches one of all regexps or not.
type Shufflable ¶
Shufflable interface is for shuffle ary.
type Ttemplate ¶
type Ttemplate struct {
*textTemplate.Template
}
Ttemplate is for rendering text rss template.
func NewTtemplate ¶
NewTtemplate adds funcmap to template var and parse files.