Documentation ¶
Index ¶
- Constants
- Variables
- func ConvertJSONObjectSafely(obj interface{}) interface{}
- func DumpResponse(resp *http.Response) (header []byte, body []byte, err error)
- func Get(object interface{}, keys []string) interface{}
- func MapToObjectJSON(fromMap map[string]interface{}, toPtr interface{}) error
- func MapToObjectYAML(fromMap map[string]interface{}, toPtr interface{}) error
- func MatchDomains(patterns []string, domain string) (isMatched bool)
- func MemoryHashKey(key string) int64
- func ObjectToMapJSON(fromPtr interface{}, toMap *map[string]interface{}) error
- func ParseVariables(source string, replacer func(varName string) (value string)) string
- type Command
- type CommandExecutor
- type MemoryCell
- func (this *MemoryCell) Delete(hashKey int64)
- func (this *MemoryCell) Increase64(key string, expireAt int64, hashKey int64, delta int64) (result int64)
- func (this *MemoryCell) Read(hashKey int64) *MemoryItem
- func (this *MemoryCell) Recycle()
- func (this *MemoryCell) Write(hashKey int64, item *MemoryItem)
- type MemoryGrid
- func (this *MemoryGrid) Delete(key string)
- func (this *MemoryGrid) Destroy()
- func (this *MemoryGrid) IncreaseInt64(key string, delta int64, lifeSeconds int64) (result int64)
- func (this *MemoryGrid) Read(key string) *MemoryItem
- func (this *MemoryGrid) WriteBytes(key string, value []byte, lifeSeconds int64)
- func (this *MemoryGrid) WriteInt64(key string, value int64, lifeSeconds int64)
- func (this *MemoryGrid) WriteItem(item *MemoryItem)
- func (this *MemoryGrid) WriteString(key string, value string, lifeSeconds int64)
- type MemoryItem
- type MemoryItemType
- type VariableHolder
Constants ¶
View Source
const ( MemoryItemTypeInt64 = 1 MemoryItemTypeString = 2 MemoryItemTypeBytes = 3 )
Variables ¶
View Source
var AllCharsets = []maps.Map{}/* 122 elements not displayed */
View Source
var BasicCharsets = []maps.Map{
{"name": "Chinese Traditional (Big5)", "charset": "big5"},
{"charset": "euc-kr", "name": "Korean (EUC)"},
{"charset": "iso-8859-1", "name": "Western Alphabet"},
{"charset": "iso-8859-2", "name": "Central European Alphabet (ISO)"},
{"charset": "iso-8859-3", "name": "Latin 3 Alphabet (ISO)"},
{"charset": "iso-8859-4", "name": "Baltic Alphabet (ISO)"},
{"charset": "iso-8859-5", "name": "Cyrillic Alphabet (ISO)"},
{"charset": "iso-8859-6", "name": "Arabic Alphabet (ISO)"},
{"charset": "iso-8859-7", "name": "Greek Alphabet (ISO)"},
{"charset": "iso-8859-8", "name": "Hebrew Alphabet (ISO)"},
{"charset": "koi8-r", "name": "Cyrillic Alphabet (KOI8-R)"},
{"charset": "shift-jis", "name": "Japanese (Shift-JIS)"},
{"name": "Japanese (EUC)", "charset": "x-euc"},
{"charset": "utf-8", "name": "Universal Alphabet (UTF-8)"},
{"charset": "windows-1250", "name": "Central European Alphabet (Windows)"},
{"charset": "windows-1251", "name": "Cyrillic Alphabet (Windows)"},
{"charset": "windows-1252", "name": "Western Alphabet (Windows)"},
{"charset": "windows-1253", "name": "Greek Alphabet (Windows)"},
{"charset": "windows-1254", "name": "Turkish Alphabet"},
{"charset": "windows-1255", "name": "Hebrew Alphabet (Windows)"},
{"charset": "windows-1256", "name": "Arabic Alphabet (Windows)"},
{"charset": "windows-1257", "name": "Baltic Alphabet (Windows)"},
{"charset": "windows-1258", "name": "Vietnamese Alphabet (Windows)"},
{"charset": "windows-874", "name": "Thai (Windows)"},
}
数据来自 https://webcheatsheet.com/html/character_sets_list.php
View Source
var RegexpDigitNumber = regexp.MustCompile("^\\d+$")
View Source
var UsualCharsets = []maps.Map{
{"charset": "utf-8", "name": "Universal Alphabet (UTF-8)"},
{"charset": "unicode", "name": "Unicode"},
{"name": "Chinese Simplified (GB2312)", "charset": "gb2312"},
{"charset": "big5", "name": "Chinese Traditional (Big5)"},
{"charset": "iso-8859-1", "name": "Western Alphabet"},
{"charset": "euc-kr", "name": "Korean (EUC)"},
{"charset": "shift-jis", "name": "Japanese (Shift-JIS)"},
{"charset": "us-ascii", "name": "US-ASCII"},
}
Functions ¶
func ConvertJSONObjectSafely ¶ added in v0.1.2
func ConvertJSONObjectSafely(obj interface{}) interface{}
去除导致不能转换特殊内容的问题 当前不支持struct
func DumpResponse ¶
导出响应
func MapToObjectJSON ¶
通过JSON把map转换为object
func MapToObjectYAML ¶
通过YAML把map转换为object
func MatchDomains ¶
func MatchDomains(patterns []string, domain string) (isMatched bool)
从一组规则中匹配域名 支持的格式:example.com, www.example.com, .example.com, *.example.com, ~(\d+).example.com 更多参考:http://nginx.org/en/docs/http/ngx_http_core_module.html#server_name
func MemoryHashKey ¶ added in v0.1.3
func ObjectToMapJSON ¶
通过JSON把object转换为map
Types ¶
type CommandExecutor ¶ added in v0.1.2
type CommandExecutor struct {
// contains filtered or unexported fields
}
命令执行器
func (*CommandExecutor) Add ¶ added in v0.1.2
func (this *CommandExecutor) Add(command string, arg ...string)
添加命令
func (*CommandExecutor) Run ¶ added in v0.1.2
func (this *CommandExecutor) Run() (output string, err error)
执行命令
type MemoryCell ¶ added in v0.1.3
type MemoryCell struct {
// contains filtered or unexported fields
}
func NewMemoryCell ¶ added in v0.1.3
func NewMemoryCell() *MemoryCell
func (*MemoryCell) Delete ¶ added in v0.1.3
func (this *MemoryCell) Delete(hashKey int64)
func (*MemoryCell) Increase64 ¶ added in v0.1.3
func (*MemoryCell) Read ¶ added in v0.1.3
func (this *MemoryCell) Read(hashKey int64) *MemoryItem
func (*MemoryCell) Recycle ¶ added in v0.1.3
func (this *MemoryCell) Recycle()
func (*MemoryCell) Write ¶ added in v0.1.3
func (this *MemoryCell) Write(hashKey int64, item *MemoryItem)
type MemoryGrid ¶ added in v0.1.3
type MemoryGrid struct {
// contains filtered or unexported fields
}
内存缓存 | Grid | | cell1, cell2, ..., cell100000 |
func NewMemoryGrid ¶ added in v0.1.3
func NewMemoryGrid(countCells int) *MemoryGrid
func (*MemoryGrid) Delete ¶ added in v0.1.3
func (this *MemoryGrid) Delete(key string)
func (*MemoryGrid) Destroy ¶ added in v0.1.3
func (this *MemoryGrid) Destroy()
func (*MemoryGrid) IncreaseInt64 ¶ added in v0.1.3
func (this *MemoryGrid) IncreaseInt64(key string, delta int64, lifeSeconds int64) (result int64)
func (*MemoryGrid) Read ¶ added in v0.1.3
func (this *MemoryGrid) Read(key string) *MemoryItem
func (*MemoryGrid) WriteBytes ¶ added in v0.1.3
func (this *MemoryGrid) WriteBytes(key string, value []byte, lifeSeconds int64)
func (*MemoryGrid) WriteInt64 ¶ added in v0.1.3
func (this *MemoryGrid) WriteInt64(key string, value int64, lifeSeconds int64)
func (*MemoryGrid) WriteItem ¶ added in v0.1.3
func (this *MemoryGrid) WriteItem(item *MemoryItem)
func (*MemoryGrid) WriteString ¶ added in v0.1.3
func (this *MemoryGrid) WriteString(key string, value string, lifeSeconds int64)
type MemoryItem ¶ added in v0.1.3
type MemoryItem struct { Key string ExpireAt int64 Type MemoryItemType ValueInt64 int64 ValueString string ValueBytes []byte }
func NewMemoryItem ¶ added in v0.1.3
func NewMemoryItem(key string, dataType MemoryItemType) *MemoryItem
func (*MemoryItem) HashKey ¶ added in v0.1.3
func (this *MemoryItem) HashKey() int64
func (*MemoryItem) IncreaseInt64 ¶ added in v0.1.3
func (this *MemoryItem) IncreaseInt64(delta int64)
type MemoryItemType ¶ added in v0.1.3
type MemoryItemType = int
Click to show internal directories.
Click to hide internal directories.