base

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 15, 2020 License: MIT Imports: 22 Imported by: 0

README

package base

功能

  • 通用约定(常量,参数)
  • 配置管理
  • 基本工具

接口

配置管理
统一查找/加载conf.toml的所有配置项:
查找顺序:
1. 查找环境变量CONF_TOML, 如果没有跳1. 
2. 查找启动目录conf.toml, 如果没有跳2.
3. 查找当前目录conf.toml, 如果没有结束

加载顺序:
1. 替换${ENV_NAME}环境变量
2. 根据toml协议解析内容, 生成map[string]interface{}结果

通过下述API获取相关配置项, keys参数格式"A.B.C"同TOML语法, OptiXXX前缀的方法可以提供可选值, MustXXX前缀的方法会触发断言panic! Bind()方法支持绑定对象!

type BaseConfig struct {
	Http HttpConfig `json:"http" toml:"http"`
}
...
var c = new(BaseConfig)
_, _ := Bind(Ckey, c)
fmt.Println(c)

  • func Get(keys string) (interface{}, bool)
  • func GetMap(keys string) (map[string]interface{}, bool)
  • func OptiMap(keys string, def map[string]interface{}) map[string]interface{}
  • func MustMap(keys string) map[string]interface{}
  • func GetStringMap(keys string) (map[string]string, bool)
  • func OptiStringMap(keys string, def map[string]string) map[string]string
  • func MustStringMap(keys string) map[string]string
  • func GetBool(keys string) (bool, bool)
  • func OptiBool(keys string, def bool) bool
  • func MustBool(keys string) bool
  • func GetString(keys string) (string, bool)
  • func OptiString(keys string, def string) string
  • func MustString(keys string) string
  • func GetInt(keys string) (int, bool)
  • func OptiInt(keys string, def int) int
  • func MustInt(keys string) int
  • func GetInt64(keys string) (int64, bool)
  • func OptiInt64(keys string, def int64) int64
  • func MustInt64(keys string) int64
  • func GetFloat64(keys string) (float64, bool)
  • func OptiFloat64(keys string, def float64) float64
  • func MustFloat64(keys string) float64
  • func GetTime(keys string) (time.Time, bool)
  • func OptiTime(keys string, def time.Time) time.Time
  • func MustTime(keys string) time.Time
  • func GetDuration(keys string) (time.Duration, bool)
  • func OptiDuration(keys string, def time.Duration) time.Duration
  • func MustDuration(keys string) time.Duration
  • func GetSlice(keys string) ([]interface{}, bool)
  • func OptiSlice(keys string, def []interface{}) []interface{}
  • func MustSlice(keys string) []interface{}
  • func GetStringSlice(keys string) ([]string, bool)
  • func OptiStringSlice(keys string, def []string) []string
  • func MustStringSlice(keys string) []string
  • func Bind(keys string, ret interface{}) (bool, error)
  • func MustBind(keys string, ret interface{})
  • func BindWith(keys string, f BindFunc) (interface{}, bool, error)
interface{}或map[string]interface{}辅助
  • func ToString(val interface{}) string
  • func ToBool(val interface{}) bool
  • func ToInt(val interface{}) int
  • func ToInt64(val interface{}) int64
  • func ToFloat64(val interface{}) float64
  • func ToTime(val interface{}) time.Time
  • func ToDuration(val interface{}) time.Duration
  • func ToSlice(val interface{}) []interface{}
  • func ToStringSlice(val interface{}) []string
  • func ToMap(val interface{}) map[string]interface{}
  • func ToStringMap(val interface{}) map[string]string
  • func Elem(val interface{}, key string) (ret interface{}, ok bool)
  • func ElemString(val interface{}, key string) (ret string, ok bool)
  • func ElemBool(val interface{}, key string) (ret bool, ok bool)
  • func ElemInt(val interface{}, key string) (ret int, ok bool)
  • func ElemInt64(val interface{}, key string) (ret int64, ok bool)
  • func ElemFloat64(val interface{}, key string) (ret float64, ok bool)
  • func ElemTime(val interface{}, key string) (ret time.Time, ok bool)
  • func ElemDuration(val interface{}, key string) (ret time.Duration, ok bool)
  • func ElemSlice(val interface{}, key string) (ret []interface{}, ok bool)
  • func ElemStringSlice(val interface{}, key string) (ret []string, ok bool)
  • func ElemMap(val interface{}, key string) (ret map[string]interface{}, ok bool)
  • func ElemStringMap(val interface{}, key string) (ret map[string]string, ok bool)
配置加载及环境变量替换
加载顺序:
1. 环境变量env, 如果成功则结束
2. 启动目录查找name, 如果成功则结束
3. 当前目录查找name, 如果成功则结束

环境变量格式与shell相同, 请注意"-"表示后接默认值
1. ${ENV_NAME}
2. ${ENV_NAME-<默认值>}

  • func LoadConf(env string, name string) (bs []byte, path string, err error)
  • func Evaluate(val string) string
字符串处理
  • type Builder struct
    • func NewBuilder(cap int) *Builder
    • func NewBuilderPool(cap int) *sync.Pool
    • func (b *Builder) String() string
    • func (b *Builder) UnsafeString() string
    • func (b *Builder) Len() int
    • func (b *Builder) Cap() int
    • func (b *Builder) Reset() *Builder
    • func (b *Builder) grow(n int)
    • func (b *Builder) Grow(n int)
    • func (b *Builder) Back(n int)
    • func (b *Builder) Write(p []byte) (int, error)
    • func (b *Builder) WriteByte(c byte) error
    • func (b *Builder) WriteRune(r rune) (int, error)
    • func (b *Builder) WriteString(s string) (int, error)
http辅助
  • func JoinQuery(rurl string, params map[string]string) string
  • func HttpRequest(method string, url string, header map[string]string, body io.Reader) (state int, content string, err error)
  • func HttpJsonRequest(method string, url string, header map[string]string, body io.Reader) (state int, content string, err error)
  • func HttpJson(method string, url string, header map[string]string, reqobj interface{}, rspobj interface{}) (status int, err error)
  • func HttpProxy(rurl string, writer http.ResponseWriter, request *http.Request) (err error)
  • func HttpProxyHandler(rurl string) *httputil.ReverseProxy
并发辅助

提供并发池策略简单实现

type IParallel interface {
	Add(func())
	Wait()
	Close()
}
  • type IParallel interface
    • func Parallel(cap int) IParallel
统一(消息)结果

统一返回结果规则

type Result struct {
	Code int         `json:"code"`           // 消息代码, 一般地: 0表示无错误, 负表示系统错误, 正表示业务错误
	Msg  string      `json:"msg,omitempty"`  // 消息描述
	Data interface{} `json:"data,omitempty"` // 消息数据
	Tag  string      `json:"tag,omitempty"`  // 消息标签
}
  • type Result struct
    • func (r *Result) Error() string
    • func NewResult(code int, msg string, data interface{}, tag string) *Result
    • func NewErr(code int, msg string, tag string) *Result
    • func AppErr(msg string, tag string) *Result
    • func SysErr(msg string, tag string) *Result
本机首个私有IPv4
  • func FirstPrivIpv4() string
murmur32
  • func MMHash32(data []byte) uint32
其他杂项
  • func MarshalToml(vl interface{}) (bs []byte, err error)
  • func Json(v interface{}) string
  • func IfBool(c bool, v1 bool, v2 bool) bool
  • func IfInt(c bool, v1 int, v2 int) int
  • func IfInt64(c bool, v1 int64, v2 int64) int64
  • func IfFloat64(c bool, v1 float64, v2 float64) float64
  • func IfString(c bool, v1 string, v2 string) string
  • func If(c bool, v1 interface{}, v2 interface{}) interface{}

Documentation

Overview

没必要针对result配置sync.Pool,频繁操作可能会减慢性能

Index

Constants

View Source
const (
	CONF_TOML_FILE string = "conf.toml"
	PATH_STEP_SEP  byte   = '.'
	CONF_TOML_ENV  string = "CONF_TOML"

	LAYOUT_DATE       string = "2006-01-02"
	LAYOUT_TIME       string = "15:04:05"
	LAYOUT_DATETIME   string = "2006-01-02 15:04:05"
	LAYOUT_DATETIME_T string = "2006-01-02T15:04:05"

	LENGTH_DATETIME = len(LAYOUT_DATETIME)
)
View Source
const (
	ProxyBufferPool_None = "none" // 没有缓存池
	ProxyBufferPool_Sync = "sync" // 采用sync.Pool

	ProxyErrorHandler_None = "none" // 没有错误处理
	ProxyErrorHandler_Body = "body" // 将错误写到body

	REVERSE_SCHEME = "x-r-scheme"
	REVERSE_HOST   = "x-r-host"
	REVERSE_PATH   = "x-r-path"

	HTTP_BUFF_SIZE = 32 * 1024
)
View Source
const (
	StatusSuccessResult = 200
	StatusFailureResult = 210 // 勿战胜RFC常用status
	CodeAppErr          = 1   // 未知业务错误, 不需预警!
	CodeSysErr          = -1  // 未知系统错误, 需要预警!
)
View Source
const Ckey = "base"

Variables

View Source
var (
	DefaultHttpTransport *http.Transport
	DefaultHttpClient    *http.Client
	DefaultHttpProxy     *httputil.ReverseProxy
)
View Source
var ZERO_TIME = time.Unix(0, 0)

Functions

func Bind

func Bind(keys string, ret interface{}) (bool, error)

func BindWith

func BindWith(keys string, f BindFunc) (interface{}, bool, error)

func Elem

func Elem(val interface{}, key string) (ret interface{}, ok bool)

it will panic if parse key failed

func ElemBool

func ElemBool(val interface{}, key string) (ret bool, ok bool)

func ElemDuration

func ElemDuration(val interface{}, key string) (ret time.Duration, ok bool)

func ElemFloat64

func ElemFloat64(val interface{}, key string) (ret float64, ok bool)

func ElemInt

func ElemInt(val interface{}, key string) (ret int, ok bool)

func ElemInt64

func ElemInt64(val interface{}, key string) (ret int64, ok bool)

func ElemMap

func ElemMap(val interface{}, key string) (ret map[string]interface{}, ok bool)

func ElemSlice

func ElemSlice(val interface{}, key string) (ret []interface{}, ok bool)

func ElemString

func ElemString(val interface{}, key string) (ret string, ok bool)

func ElemStringMap

func ElemStringMap(val interface{}, key string) (ret map[string]string, ok bool)

func ElemStringSlice

func ElemStringSlice(val interface{}, key string) (ret []string, ok bool)

func ElemTime

func ElemTime(val interface{}, key string) (ret time.Time, ok bool)

func Evaluate

func Evaluate(val string) string

替换环境变量: ${NAME-default}, 如果没有指定"-"则保留${NAME}的字样

func FirstPrivIpv4

func FirstPrivIpv4() string

func FormatDate

func FormatDate(t time.Time) string

func FormatDateTime

func FormatDateTime(t time.Time) string

func FormatTime

func FormatTime(t time.Time) string

func Get

func Get(keys string) (interface{}, bool)

func GetBool

func GetBool(keys string) (bool, bool)

func GetDuration

func GetDuration(keys string) (time.Duration, bool)

func GetFloat64

func GetFloat64(keys string) (float64, bool)

func GetInt

func GetInt(keys string) (int, bool)

func GetInt64

func GetInt64(keys string) (int64, bool)

func GetMap

func GetMap(keys string) (map[string]interface{}, bool)

func GetSlice

func GetSlice(keys string) ([]interface{}, bool)

func GetString

func GetString(keys string) (string, bool)

func GetStringMap

func GetStringMap(keys string) (map[string]string, bool)

func GetStringSlice

func GetStringSlice(keys string) ([]string, bool)

func GetTime

func GetTime(keys string) (time.Time, bool)

func HttpJson

func HttpJson(method string, url string, header map[string]string, reqobj interface{}, rspobj interface{}) (status int, err error)

func HttpJsonRequest

func HttpJsonRequest(method string, url string, header map[string]string, body io.Reader) (state int, content string, err error)

适用于大多数情况下的ContentType都是application/json,如果不需要请用HttpRawRequest

func HttpProxy

func HttpProxy(rurl string, writer http.ResponseWriter, request *http.Request) (err error)

func HttpProxyHandler

func HttpProxyHandler(rurl string) *httputil.ReverseProxy

func HttpRequest

func HttpRequest(method string, url string, header map[string]string, body io.Reader) (state int, content string, err error)

func If

func If(c bool, v1 interface{}, v2 interface{}) interface{}

func IfBool

func IfBool(c bool, v1 bool, v2 bool) bool

func IfFloat64

func IfFloat64(c bool, v1 float64, v2 float64) float64

func IfInt

func IfInt(c bool, v1 int, v2 int) int

func IfInt64

func IfInt64(c bool, v1 int64, v2 int64) int64

func IfString

func IfString(c bool, v1 string, v2 string) string

func InitConf

func InitConf(vs map[string]interface{})

func InitHttp

func InitHttp(c *HttpConfig)

func JoinQuery

func JoinQuery(rurl string, params map[string]string) string

func Json

func Json(v interface{}) string

func LoadConf

func LoadConf(env string, name string) (bs []byte, path string, err error)

func MMHash32

func MMHash32(data []byte) uint32

GetHash returns a murmur32 hash for the data slice.

func MarshalToml

func MarshalToml(vl interface{}) (bs []byte, err error)

需要对称marshal为toml才能进行对称解析, 否则tag里面的toml:...会失败

func MustBind

func MustBind(keys string, ret interface{})

func MustBool

func MustBool(keys string) bool

func MustDuration

func MustDuration(keys string) time.Duration

func MustFloat64

func MustFloat64(keys string) float64

func MustInt

func MustInt(keys string) int

func MustInt64

func MustInt64(keys string) int64

func MustMap

func MustMap(keys string) map[string]interface{}

func MustSlice

func MustSlice(keys string) []interface{}

func MustString

func MustString(keys string) string

func MustStringMap

func MustStringMap(keys string) map[string]string

func MustStringSlice

func MustStringSlice(keys string) []string

func MustTime

func MustTime(keys string) time.Time

func NewBuilderPool

func NewBuilderPool(cap int) *sync.Pool

直接创建Pool

func OptiBool

func OptiBool(keys string, def bool) bool

func OptiDuration

func OptiDuration(keys string, def time.Duration) time.Duration

func OptiFloat64

func OptiFloat64(keys string, def float64) float64

func OptiInt

func OptiInt(keys string, def int) int

func OptiInt64

func OptiInt64(keys string, def int64) int64

func OptiMap

func OptiMap(keys string, def map[string]interface{}) map[string]interface{}

func OptiSlice

func OptiSlice(keys string, def []interface{}) []interface{}

func OptiString

func OptiString(keys string, def string) string

func OptiStringMap

func OptiStringMap(keys string, def map[string]string) map[string]string

func OptiStringSlice

func OptiStringSlice(keys string, def []string) []string

func OptiTime

func OptiTime(keys string, def time.Time) time.Time

func ParseDate

func ParseDate(v string) (ret time.Time)

func ParseDateTime

func ParseDateTime(v string) (ret time.Time)

func ParseDateTimeExt

func ParseDateTimeExt(v string) (ret time.Time)

func ParseTime

func ParseTime(v string) (ret time.Time)

func ToBool

func ToBool(val interface{}) bool

func ToDuration

func ToDuration(val interface{}) time.Duration

func ToFloat64

func ToFloat64(val interface{}) float64

func ToInt

func ToInt(val interface{}) int

func ToInt64

func ToInt64(val interface{}) int64

func ToMap

func ToMap(val interface{}) map[string]interface{}

func ToSlice

func ToSlice(val interface{}) []interface{}

func ToString

func ToString(val interface{}) string

func ToStringMap

func ToStringMap(val interface{}) map[string]string

func ToStringSlice

func ToStringSlice(val interface{}) []string

func ToTime

func ToTime(val interface{}) time.Time

Types

type BaseConfig

type BaseConfig struct {
	Http HttpConfig `json:"http" toml:"http"`
}

type BindFunc

type BindFunc func(val interface{}) (interface{}, error)

type Builder

type Builder struct {
	// contains filtered or unexported fields
}

模仿strings.Builder,但底层使用copy更直接

func NewBuilder

func NewBuilder(cap int) *Builder

func (*Builder) Back

func (b *Builder) Back(n int)

反退N个

func (*Builder) Cap

func (b *Builder) Cap() int

Cap returns the capacity of the StringBuilder's underlying byte slice. It is the total space allocated for the string being built and includes any bytes already written.

func (*Builder) Grow

func (b *Builder) Grow(n int)

func (*Builder) Len

func (b *Builder) Len() int

Len returns the number of accumulated bytes; b.Len() == len(b.String()).

func (*Builder) Reset

func (b *Builder) Reset() *Builder

Reset resets the StringBuilder to be empty.

func (*Builder) String

func (b *Builder) String() string

返回安全的string

func (*Builder) UnsafeString

func (b *Builder) UnsafeString() string

String returns the accumulated string.

func (*Builder) Write

func (b *Builder) Write(p []byte) (int, error)

Write appends the contents of p to b's buffer. Write always returns len(p), nil.

func (*Builder) WriteByte

func (b *Builder) WriteByte(c byte) error

WriteByte appends the byte c to b's buffer. The returned error is always nil.

func (*Builder) WriteRune

func (b *Builder) WriteRune(r rune) (int, error)

WriteRune appends the UTF-8 encoding of Unicode code point r to b's buffer. It returns the length of r and a nil error.

func (*Builder) WriteString

func (b *Builder) WriteString(s string) (int, error)

WriteString appends the contents of s to b's buffer. It returns the length of s and a nil error.

type HttpBufferPool

type HttpBufferPool struct {
	*sync.Pool
}

func (*HttpBufferPool) Get

func (s *HttpBufferPool) Get() []byte

func (*HttpBufferPool) Put

func (s *HttpBufferPool) Put(v []byte)

type HttpConfig

type HttpConfig struct {
	// Timeout is the maximum amount of time a dial will wait for
	// a connect to complete. If Deadline is also set, it may fail
	// earlier.
	//
	// The default is no timeout.
	//
	// When using TCP and dialing a host name with multiple IP
	// addresses, the timeout may be divided between them.
	//
	// With or without a timeout, the operating system may impose
	// its own earlier timeout. For instance, TCP timeouts are
	// often around 3 minutes.
	ConnectTimeout time.Duration `json:"connect_timeout" toml:"connect_timeout"`

	// KeepAlive specifies the keep-alive period for an active
	// network connection.
	// If zero, keep-alives are enabled if supported by the protocol
	// and operating system. Network protocols or operating systems
	// that do not support keep-alives ignore this field.
	// If negative, keep-alives are disabled.
	KeepAlive time.Duration `json:"keep_alive" toml:"keep_alive"`

	// MaxIdleConns controls the maximum number of idle (keep-alive)
	// connections across all hosts. Zero means no limit.
	MaxIdleConns int `json:"max_idle_conns" toml:"max_idle_conns"`

	// MaxIdleConnsPerHost, if non-zero, controls the maximum idle
	// (keep-alive) connections to keep per-host. If zero,
	// DefaultMaxIdleConnsPerHost is used.
	MaxIdleConnsPerHost int `json:"max_idle_conns_per_host" toml:"max_idle_conns_per_host"`

	// MaxConnsPerHost optionally limits the total number of
	// connections per host, including connections in the dialing,
	// active, and idle states. On limit violation, dials will block.
	//
	// Zero means no limit.
	//
	// For HTTP/2, this currently only controls the number of new
	// connections being created at a time, instead of the total
	// number. In practice, hosts using HTTP/2 only have about one
	// idle connection, though.
	MaxConnsPerHost int `json:"max_conns_per_host" toml:"max_conns_per_host"`

	// IdleConnTimeout is the maximum amount of time an idle
	// (keep-alive) connection will remain idle before closing
	// itself.
	// Zero means no limit.
	IdleConnTimeout time.Duration `json:"idle_conn_timeout" toml:"idle_conn_timeout"`
	// TLSHandshakeTimeout specifies the maximum amount of time waiting to
	// wait for a TLS handshake. Zero means no timeout.
	TLSHandshakeTimeout time.Duration `json:"tls_handshake_timeout" toml:"tls_handshake_timeout"`

	// DisableCompression, if true, prevents the Transport from
	// requesting compression with an "Accept-Encoding: gzip"
	// request header when the Request contains no existing
	// Accept-Encoding value. If the Transport requests gzip on
	// its own and gets a gzipped response, it's transparently
	// decoded in the Response.Body. However, if the user
	// explicitly requested gzip it is not automatically
	// uncompressed.
	DisableCompression bool `json:"disable_compression" toml:"disable_compression"`

	// ResponseHeaderTimeout, if non-zero, specifies the amount of
	// time to wait for a server's response headers after fully
	// writing the request (including its body, if any). This
	// time does not include the time to read the response body.
	ResponseHeaderTimeout time.Duration `json:"response_header_timeout" toml:"response_header_timeout"`

	// ExpectContinueTimeout, if non-zero, specifies the amount of
	// time to wait for a server's first response headers after fully
	// writing the request headers if the request has an
	// "Expect: 100-continue" header. Zero means no timeout and
	// causes the body to be sent immediately, without
	// waiting for the server to approve.
	// This time does not include the time to send the request header.
	ExpectContinueTimeout time.Duration `json:"expect_continue_timeout" toml:"expect_continue_timeout"`

	// MaxResponseHeaderBytes specifies a limit on how many
	// response bytes are allowed in the server's response
	// header.
	//
	// Zero means to use a default limit.
	MaxResponseHeaderBytes int64 `json:"max_response_header_bytes" toml:"max_response_header_bytes"`

	// WriteBufferSize specifies the size of the write buffer used
	// when writing to the transport.
	// If zero, a default (currently 4KB) is used.
	WriteBufferSize int `json:"write_buffer_size" toml:"write_buffer_size"`

	// ReadBufferSize specifies the size of the read buffer used
	// when reading from the transport.
	// If zero, a default (currently 4KB) is used.
	ReadBufferSize int `json:"read_buffer_size" toml:"read_buffer_size"`

	// ForceAttemptHTTP2 controls whether HTTP/2 is enabled when a non-zero
	// Dial, DialTLS, or DialContext func or TLSClientConfig is provided.
	// By default, use of any those fields conservatively disables HTTP/2.
	// To use a custom dialer or TLS config and still attempt HTTP/2
	// upgrades, set this to true.
	ForceAttemptHTTP2 bool `json:"force_attempt_http_2" toml:"force_attempt_http_2"`

	// Timeout specifies a time limit for requests made by this
	// Client. The timeout includes connection time, any
	// redirects, and reading the response body. The timer remains
	// running after Get, Head, Post, or Do return and will
	// interrupt reading of the Response.Body.
	//
	// A Timeout of zero means no timeout.
	//
	// The Client cancels requests to the underlying Transport
	// as if the Request's Context ended.
	//
	// For compatibility, the Client will also use the deprecated
	// CancelRequest method on Transport if found. New
	// RoundTripper implementations should use the Request's Context
	// for cancelation instead of implementing CancelRequest.
	RequestTimeout time.Duration `json:"request_timeout" toml:"request_timeout"`

	// FlushInterval specifies the flush interval
	// to flush to the client while copying the
	// response body.
	// If zero, no periodic flushing is done.
	// A negative value means to flush immediately
	// after each write to the client.
	// The FlushInterval is ignored when ReverseProxy
	// recognizes a response as a streaming response;
	// for such responses, writes are flushed to the client
	// immediately.
	ProxyFlushInterval time.Duration `json:"proxy_flush_interval" toml:"proxy_flush_interval"`

	// BufferPool optionally specifies a buffer pool to
	// get byte slices for use by io.CopyBuffer when copying HTTP response bodies.
	// Values: none, sync
	ProxyBufferPool string `json:"proxy_buffer_pool" toml:"proxy_buffer_pool"`

	// ErrorHandler is an optional function that handles errors
	// reaching the backend or errors from ModifyResponse.
	// Values: none, body
	ProxyErrorHandler string `json:"proxy_error_handler" toml:"proxy_error_handler"`

	// 用于proxyBufferPool的init size
	HttpBuffSize int `json:"http_buff_size" toml:"http_buff_size"`
}

type IParallel

type IParallel interface {
	Add(func())
	Wait()
	Close()
}

func Parallel

func Parallel(cap int) IParallel

type Result

type Result struct {
	Code int         `json:"code"`           // 消息代码, 一般地: 0表示无错误, 负表示系统错误, 正表示业务错误
	Msg  string      `json:"msg,omitempty"`  // 消息描述
	Data interface{} `json:"data,omitempty"` // 消息数据
	Tag  string      `json:"tag,omitempty"`  // 消息标签
}

func AppErr

func AppErr(msg string, tag string) *Result

func NewErr

func NewErr(code int, msg string, tag string) *Result

func NewResult

func NewResult(code int, msg string, data interface{}, tag string) *Result

func SysErr

func SysErr(msg string, tag string) *Result

func (*Result) Error

func (r *Result) Error() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL