Documentation
¶
Index ¶
- Constants
- Variables
- func After(f AfterHandle)
- func All(pattern string, f func(ctx *Context))
- func AppDir() string
- func AppName() string
- func Auth(f AuthorizationHandle)
- func Before(f BeforeHandle)
- func Command() bool
- func Conf() *conf.AppConf
- func Debug(debug bool)
- func Exist(filename string) bool
- func ExistAndAutoMkdir(filename string) (err error)
- func False() *bool
- func FileDefault(dir string)
- func FileDir() string
- func FileMerge(ctx *Context, dir string)
- func FileMergeHandle(dir string) func(ctx *Context)
- func FileRouter(dir, access, upload, merge string)
- func FileServer(pattern string, root string)
- func FileUpload(ctx *Context, dir, access string)
- func FileUploadHandle(dir, access string) func(ctx *Context)
- func GUID() string
- func ID() int64
- func IsRuning() bool
- func LangDir(dir string) error
- func LangFile(file string) error
- func MaxDay(month int) int
- func Migration(f MigrationHandle)
- func NoLookDirHandler(h http.Handler) http.Handler
- func RegistConf(handle conf.ConfingHandle, finish ...conf.FinishHandle)
- func Registry() error
- func Router()
- func Run(addr string)
- func RunWithTLS(addr, certFile, keyFile string)
- func Serve() bool
- func ServeTLSWithAddr(addr, certFile, keyFile string) bool
- func ServeWithAddr(addr string) bool
- func ServiceName(key string) string
- func ServiceNames(key string) []string
- func Shutdown(ctx context.Context) error
- func String(s string) *string
- func TimeRangeWithYearMonth(year, month int) (start, end time.Time)
- func Trans(language, key string, param ...string) string
- func Transf(language, key string, param ...interface{}) string
- func True() *bool
- func TryServe() bool
- func UserConf() interface{}
- type AfterHandle
- type App
- type AuthorizationHandle
- type BeforeHandle
- type Context
- func (c *Context) BaseURL(url ...string) string
- func (c *Context) ClientIP() string
- func (c *Context) Data(v interface{})
- func (c *Context) DataResult(v interface{})
- func (c *Context) DataWithCode(v interface{}, code int)
- func (c *Context) DataWithCodeMsg(v interface{}, code int, msg string)
- func (c *Context) DataWithMsg(v interface{}, msg string)
- func (c *Context) DefaultFileURL(url string) string
- func (c *Context) Exist(filename string) bool
- func (c *Context) FailResult(msg string, errCode int, err ...error)
- func (c *Context) Failed(msg string, err ...error)
- func (c *Context) Failedf(format string, a ...interface{})
- func (c *Context) Faileds(msg string, detail string)
- func (c *Context) Flush()
- func (c *Context) Form() url.Values
- func (c *Context) GUID() string
- func (c *Context) GetBool(key string) bool
- func (c *Context) GetBoolValue(key string, def bool) bool
- func (c *Context) GetFloat(key string) (float64, error)
- func (c *Context) GetFloatValue(key string, def float64) float64
- func (c *Context) GetInt(key string) (int, error)
- func (c *Context) GetInt64(key string) (int64, error)
- func (c *Context) GetInt64Value(key string, def int64) int64
- func (c *Context) GetIntSlice(key, sep string) []int64
- func (c *Context) GetIntSliceAndRemovePrefix(key, sep, prefix string) ([]int64, bool)
- func (c *Context) GetIntValue(key string, def int) int
- func (c *Context) GetLang() string
- func (c *Context) GetLeftLikeString(key string) string
- func (c *Context) GetLikeString(key string) string
- func (c *Context) GetPage() (page int, total int, pageRow int)
- func (c *Context) GetParam(key string) string
- func (c *Context) GetRightLikeString(key string) string
- func (c *Context) GetString(key string) string
- func (c *Context) GetStringSlice(key, sep string) []string
- func (c *Context) GetStringValue(key string, def string) string
- func (c *Context) GetStrings(key string) []string
- func (c *Context) GetTrimString(key string) string
- func (c *Context) HasParam(key string) bool
- func (c *Context) Hijack() (net.Conn, *bufio.ReadWriter, error)
- func (c *Context) ID() int64
- func (c *Context) JSON(v interface{})
- func (c *Context) JSON2String(obj interface{}) (string, error)
- func (c *Context) JSONDecode(r io.Reader, obj interface{}) (err error)
- func (c *Context) JSONObj(obj interface{}, verify ...bool) error
- func (c *Context) JSONResult(v interface{})
- func (c *Context) JSONWithCode(v interface{}, code int)
- func (c *Context) JSONWithCodeMsg(v interface{}, code int, msg string)
- func (c *Context) JSONWithMsg(v interface{}, msg string)
- func (c *Context) JSONWithPage(v interface{}, page, total int)
- func (c *Context) JSONWithPageCode(v interface{}, page, total, code int)
- func (c *Context) JSONWithPageCodeMsg(v interface{}, page, total, code int, msg string)
- func (c *Context) MapObj() map[string]interface{}
- func (c *Context) NoData(msg string)
- func (c *Context) Obj(obj interface{}, verify ...bool) error
- func (c *Context) ObjWithCodeMsg(v interface{}, code int, msg string) interface{}
- func (c *Context) ObjWithPageCodeMsg(v interface{}, page, total, code int, msg string) interface{}
- func (c *Context) Offset(total int) int
- func (c *Context) Page(v interface{}, page, total int)
- func (c *Context) PageWithCode(v interface{}, page, total, code int)
- func (c *Context) PageWithCodeMsg(v interface{}, page, total, code int, msg string)
- func (c *Context) ParseForm()
- func (c *Context) ParseMultipartForm(maxMemory int64) error
- func (c *Context) PostForm() url.Values
- func (c *Context) Proxys() []string
- func (c *Context) Pusher() http.Pusher
- func (c *Context) Query() url.Values
- func (c *Context) RawString() string
- func (c *Context) Redirect(url string)
- func (c *Context) Reset()
- func (c *Context) Result(msg string, detail ...string)
- func (c *Context) Say(data []byte)
- func (c *Context) Says(str string)
- func (c *Context) SendFile(fileName string, rawFileName ...string)
- func (c *Context) SessionClear() error
- func (c *Context) SessionDelete(key string) error
- func (c *Context) SessionID() string
- func (c *Context) SessionRead(key string) interface{}
- func (c *Context) SessionWrite(key string, value interface{}) error
- func (c *Context) SignOut(msg string)
- func (c *Context) StatusCode(statusCode int)
- func (c *Context) String2JSON(str string, obj interface{}) error
- func (c *Context) Success(msg string)
- func (c *Context) Successf(format string, a ...interface{})
- func (c *Context) TemporaryRedirect(url string)
- func (c *Context) Trans(key string, param ...string) string
- func (c *Context) Transf(key string, param ...interface{}) string
- func (c *Context) URL() string
- func (c *Context) Validate(rules ...string) error
- func (c *Context) Verify(rules ...string) error
- func (c *Context) XML(v interface{})
- func (c *Context) XMLDecode(r io.Reader, obj interface{}) (err error)
- func (c *Context) XMLObj(obj interface{}, verify ...bool) error
- func (c *Context) XMLResult(v interface{})
- func (c *Context) XMLWithCode(v interface{}, code int)
- func (c *Context) XMLWithCodeMsg(v interface{}, code int, msg string)
- func (c *Context) XMLWithMsg(v interface{}, msg string)
- func (c *Context) XMLWithPage(v interface{}, page, total int)
- func (c *Context) XMLWithPageCode(v interface{}, page, total, code int)
- func (c *Context) XMLWithPageCodeMsg(v interface{}, page, total, code int, msg string)
- func (c *Context) YAML(v interface{})
- func (c *Context) YAMLDecode(r io.Reader, obj interface{}) (err error)
- func (c *Context) YAMLObj(obj interface{}, verify ...bool) error
- func (c *Context) YAMLResult(v interface{})
- func (c *Context) YAMLWithCode(v interface{}, code int)
- func (c *Context) YAMLWithCodeMsg(v interface{}, code int, msg string)
- func (c *Context) YAMLWithMsg(v interface{}, msg string)
- func (c *Context) YAMLWithPage(v interface{}, page, total int)
- func (c *Context) YAMLWithPageCode(v interface{}, page, total, code int)
- func (c *Context) YAMLWithPageCodeMsg(v interface{}, page, total, code int, msg string)
- type Date
- func DateByBTime(t Time) Date
- func DateByBTimes(t *Time) Date
- func DateByTime(t time.Time) Date
- func DateWithString(t string, layout ...string) (Date, error)
- func DatesByBTime(t Time) *Date
- func DatesByBTimes(t *Time) *Date
- func DatesByTime(t time.Time) *Date
- func DatesWithString(t string, layout ...string) (*Date, error)
- func NowDate() Date
- func NowDates() *Date
- func (t Date) After(u Date) bool
- func (t Date) Before(u Date) bool
- func (t Date) Equal(u Date) bool
- func (t Date) MarshalJSON() ([]byte, error)
- func (t *Date) Scan(v interface{}) error
- func (t Date) String() string
- func (t *Date) UnmarshalJSON(b []byte) error
- func (t Date) Value() (driver.Value, error)
- type Datum
- type Float32
- type Float64
- type Fs
- type Int
- type Int64
- type InvalidPagination
- type Message
- type MessageDetail
- type MethodNotAllowedHandler
- type MethodOptionsHandler
- type MigrationHandle
- type NotFoundHandler
- type Pagination
- type Pattern
- func Delete(pattern string, f func(ctx *Context)) *Pattern
- func Get(pattern string, f func(ctx *Context)) *Pattern
- func Head(pattern string, f func(ctx *Context)) *Pattern
- func Options(pattern string, f func(ctx *Context)) *Pattern
- func Patch(pattern string, f func(ctx *Context)) *Pattern
- func Post(pattern string, f func(ctx *Context)) *Pattern
- func Put(pattern string, f func(ctx *Context)) *Pattern
- func (c *Pattern) Auth() *Pattern
- func (c *Pattern) Nickname(name string) *Pattern
- func (c *Pattern) Param(Parameter interface{}) *Pattern
- func (c *Pattern) Registry(service string) *Pattern
- func (c *Pattern) Router() *Pattern
- func (c *Pattern) Unauth() *Pattern
- func (c *Pattern) Unregistry() *Pattern
- type Time
- func Now() Time
- func NowTime() *Time
- func Nows() *Time
- func NowsNil() *Time
- func TimeByDate(d Date) Time
- func TimeByDates(d *Date) Time
- func TimeByTime(t time.Time) Time
- func TimeWithString(t string, layout ...string) (Time, error)
- func TimesByDate(d Date) *Time
- func TimesByDates(d *Date) *Time
- func TimesByTime(t time.Time) *Time
- func TimesWithString(t string, layout ...string) (*Time, error)
- func (t Time) After(u Time) bool
- func (t Time) Before(u Time) bool
- func (t Time) Equal(u Time) bool
- func (t Time) Format(layout string) string
- func (t Time) MarshalJSON() ([]byte, error)
- func (t *Time) Scan(v interface{}) error
- func (t Time) String() string
- func (t *Time) T() *time.Time
- func (t *Time) UnmarshalJSON(b []byte) error
- func (t Time) Value() (driver.Value, error)
- type UInt
- type UInt64
Constants ¶
const ( SerError = 0 // error code SerOK = 1 // ok code SerDBError = -10000 // db error code SerNoDataError = -20000 // no data error code SerSignOutError = -30000 // user sign out error code SerUserNotExistError = -40000 // user not exist code SerInvalidParamError = -50000 // invalid param code SerInvalidUserAuthorize = -60000 // invalid user authorize code SerExist = -70000 // exist code SerNotExist = -80000 // not exist code SerTry = -99999 // please try code SerMustFailed = -111111 // must failed code SerFailed = -222222 // failed code SerAuthorizationFailed = -888888 // authorization failed code KindAcceptJSON = 0 // json KindAcceptXML = 1 // xml KindAcceptYAML = 2 // yaml )
const code
Variables ¶
var (
Log *logs.Log
)
var
Functions ¶
func All ¶ added in v1.1.3
All registers the handler function for the given pattern in the DefaultServeMux. The documentation for ServeMux explains how patterns are matched.
func Auth ¶ added in v1.1.7
func Auth(f AuthorizationHandle)
Auth set the request 'authorization' handle
func Exist ¶ added in v1.1.6
Exist returns a boolean indicating whether the error is known to report that a file or directory does not exist. It is satisfied by ErrNotExist as well as some syscall errors.
func ExistAndAutoMkdir ¶ added in v1.1.6
ExistAndAutoMkdir Check that the file directory exists, there is no automatically created
func FileDir ¶ added in v1.1.1
func FileDir() string
FileDir if app config configuration fileDir return it,orherwise return app exec path
func FileMergeHandle ¶ added in v1.1.7
FileMergeHandle return merge handle
func FileRouter ¶ added in v1.1.7
func FileRouter(dir, access, upload, merge string)
FileRouter file router
func FileServer ¶
FileServer registers the handler function for the given pattern in the DefaultServeMux. The documentation for ServeMux explains how patterns are matched.
func FileUploadHandle ¶
FileUploadHandle return a upload handle
func NoLookDirHandler ¶
NoLookDirHandler disable directory look
func RegistConf ¶ added in v1.1.2
func RegistConf(handle conf.ConfingHandle, finish ...conf.FinishHandle)
RegistConf handler conf
func RunWithTLS ¶ added in v1.1.5
func RunWithTLS(addr, certFile, keyFile string)
RunWithTLS use addr and cert to start app
func ServeTLSWithAddr ¶ added in v1.1.5
ServeTLSWithAddr use addr and certFile, keyFile to start app
func ServeWithAddr ¶ added in v1.1.5
ServeWithAddr use addr to start app
func ServiceName ¶ added in v1.1.7
ServiceName random gets url with service name
func ServiceNames ¶ added in v1.1.7
ServiceNames gets all url with service name
func TimeRangeWithYearMonth ¶ added in v1.1.1
TimeRangeWithYearMonth returns the time(year,month) of the specified mininum and maxnum time
Types ¶
type AfterHandle ¶
AfterHandle a after handler for each request
type App ¶
type App struct { Router *httprouter.Router Addr, CertFile, KeyFile string Server *http.Server Before BeforeHandle After AfterHandle Authorization AuthorizationHandle Migration MigrationHandle Debug, Daemon bool // contains filtered or unexported fields }
App is application major data
func (*App) ListenAndServe ¶
ListenAndServe see net/http ListenAndServe
func (*App) ListenAndServeTLS ¶ added in v1.1.5
ListenAndServeTLS see net/http ListenAndServeTLS
type AuthorizationHandle ¶ added in v1.1.4
AuthorizationHandle a authorization handler for each request
type BeforeHandle ¶
BeforeHandle a before handler for each request
type Context ¶
type Context struct { //In A Request represents an HTTP request received by a server // or to be sent by a client. In *http.Request //Accept Accept string //Kind Accept KindAccept int //Out A ResponseWriter interface is used by an HTTP handler to // construct an HTTP response. Out http.ResponseWriter //Params httprouter Params,/:name/:age Params httprouter.Params //NeedAuthorization is need authorization NeedAuthorization bool //IsAuthorization is authorization finish? IsAuthorization bool //Session is session Session engine.Store //Router Router *Pattern // contains filtered or unexported fields }
Context is app Context
func (*Context) BaseURL ¶
BaseURL gets root url(scheme+host) from current request param:
url relative path
func (*Context) Data ¶ added in v1.1.4
func (c *Context) Data(v interface{})
Data output Data data to client v data
func (*Context) DataResult ¶ added in v1.1.4
func (c *Context) DataResult(v interface{})
DataResult output Data data to client
func (*Context) DataWithCode ¶ added in v1.1.4
DataWithCode output Data data to client v data code is message code
func (*Context) DataWithCodeMsg ¶ added in v1.1.4
DataWithCodeMsg output data to client v data code is message code msg is string message
func (*Context) DataWithMsg ¶ added in v1.1.4
DataWithMsg output data to client v data msg is string message
func (*Context) DefaultFileURL ¶ added in v1.0.7
DefaultFileURL returns full file url param:
url is relative path
func (*Context) Exist ¶
Exist returns a boolean indicating whether the error is known to report that a file or directory does not exist. It is satisfied by ErrNotExist as well as some syscall errors.
func (*Context) FailResult ¶
FailResult output fail result to client param:
msg failed message errCode ailed message code err error
func (*Context) Faileds ¶ added in v1.1.1
Faileds output failed detail result to client param:
msg is fail message detail is detail message
func (*Context) Flush ¶ added in v1.1.6
func (c *Context) Flush()
Flush sends any buffered data to the client
func (*Context) GetBool ¶
GetBool get a bool value from the current request based on the key param:
key is key name
func (*Context) GetBoolValue ¶ added in v1.1.3
GetBoolValue get a bool value from the current request based on the key param:
key is key name def is default value
func (*Context) GetFloat ¶
GetFloat gets a float value from the current request uri based on the key param:
key is key name def default value
func (*Context) GetFloatValue ¶ added in v1.1.3
GetFloatValue gets a float value from the current request based on the key(errors not included) param:
key is key name def default value
func (*Context) GetInt ¶
GetInt gets a int value from the current request based on the key param:
key is key name def default value
func (*Context) GetInt64 ¶
GetInt64 gets a int64 value from the current request url based on the key param:
key is key name def default value
func (*Context) GetInt64Value ¶ added in v1.1.3
GetInt64Value gets a int64 value from the current request based on the key(errors not included) param:
key is key name def default value
func (*Context) GetIntSlice ¶
GetIntSlice Use the key to get all int value from the current request param:
key is key name sep spilt char
func (*Context) GetIntSliceAndRemovePrefix ¶
GetIntSliceAndRemovePrefix Use the key to get all int value from the current request and remove prefix of each param:
key is key name sep spilt char prefix remove prefix string
func (*Context) GetIntValue ¶ added in v1.1.3
GetIntValue gets a int value from the current request based on the key(errors not included) param:
key is key name def default value
func (*Context) GetLeftLikeString ¶
GetLeftLikeString get a sql(left like 'xx%') string value from the current request based on the key param:
key is key name
func (*Context) GetLikeString ¶
GetLikeString get a sql(like '%xx%') string value from the current request based on the key param:
key is key name
func (*Context) GetPage ¶ added in v1.1.5
GetPage get page param from the current request and check last page param:
page current page index(start 1) total all data total count(cache total count for first service return) pageRow page maximum size(default is 100 row)
func (*Context) GetParam ¶
GetParam Use the key to get all int value from the current request url note:xx/:name/:name2 param:
key key name
func (*Context) GetRightLikeString ¶
GetRightLikeString get a sql(right like '%xx') string value from the current request based on the key param:
key is key name
func (*Context) GetString ¶
GetString gets a string value from the current request based on the key param:
key is key name
func (*Context) GetStringSlice ¶
GetStringSlice Use the key to get all string value from the current request param:
key is key name sep spilt char
func (*Context) GetStringValue ¶ added in v1.1.7
GetStringValue gets a string value from the current request based on the key param:
key is key name def is default value
func (*Context) GetStrings ¶
GetStrings gets strings from the current request based on the key param:
key is key name
func (*Context) GetTrimString ¶
GetTrimString Use the key to get a non-space string value from the current request param:
key is key name
func (*Context) HasParam ¶ added in v1.1.1
HasParam has a param from the current request based on the key(May not have a value) param:
key is key name
func (*Context) JSONDecode ¶
JSONDecode gets data from the r reader(json fromat) and convert it to a objecet param:
r is a reader obj target object
func (*Context) JSONObj ¶
JSONObj gets data from the current request body(json fromat) and convert it to a objecet param:
obj target object verify verify obj
func (*Context) JSONResult ¶
func (c *Context) JSONResult(v interface{})
JSONResult output json data to client
func (*Context) JSONWithCode ¶
JSONWithCode output JSON data to client v data code is message code
func (*Context) JSONWithCodeMsg ¶
JSONWithCodeMsg output JSON data to client v data code is message code msg is string message
func (*Context) JSONWithMsg ¶
JSONWithMsg output JSON data to client v data msg is string message
func (*Context) JSONWithPage ¶
JSONWithPage output pagination JSON data to client v data page is page total is total row count
func (*Context) JSONWithPageCode ¶ added in v1.1.5
JSONWithPageCode output pagination JSON data to client v data page is page total is total row count code is message code
func (*Context) JSONWithPageCodeMsg ¶ added in v1.1.5
JSONWithPageCodeMsg output pagination JSON data to client v data page is page total is total row count code is message code msg is string message
func (*Context) Obj ¶ added in v1.1.3
Obj gets data from the current request body(json or xml or yaml fromat) and convert it to a objecet param:
obj target object verify verify obj
func (*Context) ObjWithCodeMsg ¶ added in v1.1.4
ObjWithCodeMsg return obj data v data code is message code msg is string message
func (*Context) ObjWithPageCodeMsg ¶ added in v1.1.5
ObjWithPageCodeMsg return pagination obj data v data page is page total is total row count code is message code msg is string message
func (*Context) Offset ¶ added in v1.1.1
Offset return page offset param:
total all data total count(cache total count for first service return)
func (*Context) Page ¶ added in v1.1.1
Page output pagination data data to client v data page is page total is total row count
func (*Context) PageWithCode ¶ added in v1.1.5
PageWithCode output pagination data to client v data page is page total is total row count code is message code
func (*Context) PageWithCodeMsg ¶ added in v1.1.5
PageWithCodeMsg output pagination data to client v data page is page total is total row count code is message code msg is string message
func (*Context) ParseForm ¶
func (c *Context) ParseForm()
ParseForm populates r.Form and r.PostForm.
For all requests, ParseForm parses the raw query from the URL and updates r.Form.
For POST, PUT, and PATCH requests, it also parses the request body as a form and puts the results into both r.PostForm and r.Form. Request body parameters take precedence over URL query string values in r.Form.
For other HTTP methods, or when the Content-Type is not application/x-www-form-urlencoded, the request Body is not read, and r.PostForm is initialized to a non-nil, empty value.
If the request Body's size has not already been limited by MaxBytesReader, the size is capped at 10MB.
ParseMultipartForm calls ParseForm automatically. ParseForm is idempotent.
func (*Context) ParseMultipartForm ¶
ParseMultipartForm parses a request body as multipart/form-data. The whole request body is parsed and up to a total of maxMemory bytes of its file parts are stored in memory, with the remainder stored on disk in temporary files. ParseMultipartForm calls ParseForm if necessary. After one call to ParseMultipartForm, subsequent calls have no effect.
func (*Context) Proxys ¶
Proxys return request proxys if request header has X-Real-IP, return it if request header has X-Forwarded-For, return it
func (*Context) Pusher ¶ added in v1.1.6
Pusher is the interface implemented by ResponseWriters that support HTTP/2 server push. For more background, see https://tools.ietf.org/html/rfc7540#section-8.2.
func (*Context) RawString ¶ added in v1.1.3
RawString getter raw string value from current request(request body)
func (*Context) Result ¶ added in v1.1.1
Result output result to client param:
msg is fail message detail is detail message
func (*Context) SendFile ¶
SendFile send file to client param:
fileName is file name rawFileName is raw file name
func (*Context) SessionClear ¶ added in v1.1.1
SessionClear delete all session
func (*Context) SessionDelete ¶ added in v1.1.1
SessionDelete delete session value by key
func (*Context) SessionRead ¶ added in v1.1.1
SessionRead get session value by key
func (*Context) SessionWrite ¶ added in v1.1.1
SessionWrite set session value by key
func (*Context) StatusCode ¶
StatusCode set current request statusCode param:
statusCode HTTP status code. such as: 200x,300x and so on
func (*Context) String2JSON ¶ added in v1.1.3
String2JSON string to JSON param:
str json string obj is object
func (*Context) TemporaryRedirect ¶
TemporaryRedirect redirect(note: 307 redirect,Can avoid data loss after POST redirection)
func (*Context) Validate ¶ added in v1.1.7
Validate verify current request param: rules is validate rule such as:
key1@required|int|min:1 key2/key2_translator@required|string|min:1 key3@sometimes|required|data
func (*Context) Verify ¶ added in v1.1.3
Verify verify current request param: rules is validate rule such as:
key1@required|int|min:1 key2/key2_translator@required|string|min:1 key3@sometimes|required|data
func (*Context) XML ¶ added in v1.1.4
func (c *Context) XML(v interface{})
XML output XML data to client v data
func (*Context) XMLDecode ¶
XMLDecode gets data from the r reader(xml format) and convert it to a object param:
r is a reader obj target object
func (*Context) XMLObj ¶
XMLObj gets data from the current request(xml format) and convert it to a object param:
obj target object verify verify obj
func (*Context) XMLResult ¶ added in v1.1.4
func (c *Context) XMLResult(v interface{})
XMLResult output xml data to client
func (*Context) XMLWithCode ¶ added in v1.1.4
XMLWithCode output XML data to client v data code is message code
func (*Context) XMLWithCodeMsg ¶ added in v1.1.4
XMLWithCodeMsg output XML data to client v data code is message code msg is string message
func (*Context) XMLWithMsg ¶ added in v1.1.4
XMLWithMsg output XML data to client v data msg is string message
func (*Context) XMLWithPage ¶ added in v1.1.5
XMLWithPage output pagination XML data to client v data page is page total is total row count
func (*Context) XMLWithPageCode ¶ added in v1.1.5
XMLWithPageCode output pagination XML data to client v data page is page total is total row count code is message code
func (*Context) XMLWithPageCodeMsg ¶ added in v1.1.5
XMLWithPageCodeMsg output pagination XML data to client v data page is page total is total row count code is message code msg is string message
func (*Context) YAML ¶ added in v1.1.4
func (c *Context) YAML(v interface{})
YAML output YAML data to client v data
func (*Context) YAMLDecode ¶ added in v1.1.4
YAMLDecode gets data from the r reader(yaml format) and convert it to a object param:
r is a reader obj target object
func (*Context) YAMLObj ¶ added in v1.1.4
YAMLObj gets data from the current request(yaml format) and convert it to a object param:
obj target object verify verify obj
func (*Context) YAMLResult ¶ added in v1.1.4
func (c *Context) YAMLResult(v interface{})
YAMLResult output yaml data to client
func (*Context) YAMLWithCode ¶ added in v1.1.4
YAMLWithCode output YAML data to client v data code is message code
func (*Context) YAMLWithCodeMsg ¶ added in v1.1.4
YAMLWithCodeMsg output YAML data to client v data code is message code msg is string message
func (*Context) YAMLWithMsg ¶ added in v1.1.4
YAMLWithMsg output YAML data to client v data msg is string message
func (*Context) YAMLWithPage ¶ added in v1.1.5
YAMLWithPage output pagination YAML data to client v data page is page total is total row count
func (*Context) YAMLWithPageCode ¶ added in v1.1.5
YAMLWithPageCode output pagination YAML data to client v data page is page total is total row count code is message code
func (*Context) YAMLWithPageCodeMsg ¶ added in v1.1.5
YAMLWithPageCodeMsg output pagination YAML data to client v data page is page total is total row count code is message code msg is string message
type Date ¶
type Date Time
Date yyyy-MM-dd format date 1: auto handle string to time
func DateWithString ¶ added in v1.1.1
DateWithString string to Date
func DatesByBTime ¶ added in v1.1.2
DatesByBTime *bast.Time to *Date
func DatesByBTimes ¶ added in v1.1.2
DatesByBTimes *bast.Time to *Date
func DatesByTime ¶ added in v1.0.4
DatesByTime time.Time to *Date
func DatesWithString ¶ added in v1.1.1
DatesWithString string to *Date
func (Date) Equal ¶ added in v1.1.1
Equal reports whether t and u represent the same time instant. Two times can be equal even if they are in different locations. For example, 6:00 +0200 CEST and 4:00 UTC are Equal. See the documentation on the Time type for the pitfalls of using == with Time values; most code should use Equal instead.
func (*Date) UnmarshalJSON ¶
UnmarshalJSON JSON UnmarshalJSON
type Datum ¶ added in v1.1.4
type Datum struct { Message `yaml:",inline"` XMLName xml.Name `xml:"data" json:"-" yaml:"-"` Data interface{} `json:"data" xml:"data>data" yaml:"data"` }
Datum is response data
type Float32 ¶
type Float32 float32
Float32 is auto handle string to float32
func (*Float32) UnmarshalJSON ¶
UnmarshalJSON JSON UnmarshalJSON
type Float64 ¶
type Float64 float64
Float64 is auto handle string to float64
func (*Float64) UnmarshalJSON ¶
UnmarshalJSON JSON UnmarshalJSON
type Fs ¶ added in v1.1.6
type Fs struct { FileName string `json:"fileName"` RawName string `json:"rawName"` Chunks int `json:"chunks"` }
Fs struct
type Int ¶
type Int int
Int is auto handle string to int
func (*Int) UnmarshalJSON ¶
UnmarshalJSON JSON UnmarshalJSON
type Int64 ¶
type Int64 int64
Int64 is auto handle string to int64
func (*Int64) UnmarshalJSON ¶
UnmarshalJSON JSON UnmarshalJSON
type InvalidPagination ¶ added in v1.1.3
type InvalidPagination struct { Pagination `yaml:",inline"` XMLName xml.Name `xml:"page" json:"-" yaml:"-"` Invalid bool `json:"invalid" xml:"invalid" yaml:"invalid"` Fix bool `json:"fix" xml:"fix" yaml:"fix"` }
InvalidPagination is invalid Pagination data
type Message ¶ added in v1.1.3
type Message struct { XMLName xml.Name `xml:"msg" json:"-" yaml:"-"` Code int `json:"code" xml:"code" yaml:"code"` Msg string `json:"msg" xml:"msg" yaml:"msg"` }
Message is response message
type MessageDetail ¶ added in v1.1.3
type MessageDetail struct { XMLName xml.Name `xml:"msg" json:"-" yaml:"-"` Code int `json:"code" xml:"code" yaml:"code"` Msg string `json:"msg" xml:"msg" yaml:"msg"` Detail string `json:"detail" xml:"detail" yaml:"detail"` }
MessageDetail is response detail message
type MethodNotAllowedHandler ¶ added in v1.1.1
type MethodNotAllowedHandler struct { }
MethodNotAllowedHandler method Not Allowed
func (MethodNotAllowedHandler) ServeHTTP ¶ added in v1.1.1
func (MethodNotAllowedHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP method Not Allowed handler
type MethodOptionsHandler ¶ added in v1.1.4
type MethodOptionsHandler struct { }
MethodOptionsHandler method Options
func (MethodOptionsHandler) ServeHTTP ¶ added in v1.1.4
func (MethodOptionsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP method Options handler
type MigrationHandle ¶ added in v1.0.11
type MigrationHandle func() error
MigrationHandle is migration handler
type NotFoundHandler ¶ added in v1.1.1
type NotFoundHandler struct { }
NotFoundHandler not found
func (NotFoundHandler) ServeHTTP ¶ added in v1.1.1
func (NotFoundHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP not found handler
type Pagination ¶ added in v1.1.3
type Pagination struct { Message `yaml:",inline"` XMLName xml.Name `xml:"page" json:"-" yaml:"-"` Data interface{} `json:"data" xml:"data>data" yaml:"data"` Page int `json:"page" xml:"page" yaml:"page"` Total int `json:"total" xml:"total" yaml:"total"` }
Pagination is Pagination data
type Pattern ¶ added in v1.1.7
type Pattern struct { Method string Pattern string Fn func(ctx *Context) Parameter interface{} Name string Service string // contains filtered or unexported fields }
Pattern Pattern obj
func Delete ¶ added in v1.1.2
Delete registers the handler function for the given pattern in the DefaultServeMux. The documentation for ServeMux explains how patterns are matched.
func Get ¶
Get registers the handler function for the given pattern in the DefaultServeMux. The documentation for ServeMux explains how patterns are matched.
func Head ¶ added in v1.1.2
Head registers the handler function for the given pattern in the DefaultServeMux. The documentation for ServeMux explains how patterns are matched.
func Options ¶ added in v1.1.3
Options registers the handler function for the given pattern in the DefaultServeMux. The documentation for ServeMux explains how patterns are matched.
func Patch ¶ added in v1.1.2
Patch registers the handler function for the given pattern in the DefaultServeMux. The documentation for ServeMux explains how patterns are matched.
func Post ¶
Post registers the handler function for the given pattern in the DefaultServeMux. The documentation for ServeMux explains how patterns are matched.
func Put ¶ added in v1.1.1
Put registers the handler function for the given pattern in the DefaultServeMux. The documentation for ServeMux explains how patterns are matched.
func (*Pattern) Unregistry ¶ added in v1.1.7
Unregistry unregister to etcd etc.
type Time ¶
Time yyyy-MM-dd HH:mm:ss format time 1: auto handle string to time
func TimeWithString ¶ added in v1.0.4
TimeWithString string to Time
func TimesByTime ¶ added in v1.0.4
TimesByTime time.Time to *Time
func TimesWithString ¶ added in v1.1.2
TimesWithString string to *Time
func (Time) Equal ¶ added in v1.1.1
Equal reports whether t and u represent the same time instant. Two times can be equal even if they are in different locations. For example, 6:00 +0200 CEST and 4:00 UTC are Equal. See the documentation on the Time type for the pitfalls of using == with Time values; most code should use Equal instead.
func (*Time) UnmarshalJSON ¶
UnmarshalJSON JSON UnmarshalJSON
type UInt ¶ added in v1.0.5
type UInt uint
UInt is auto handle string to uint
func (*UInt) UnmarshalJSON ¶ added in v1.0.5
UnmarshalJSON JSON UnmarshalJSON
Directories
¶
Path | Synopsis |
---|---|
Package snowflake provides a very simple Twitter snowflake generator and parser.
|
Package snowflake provides a very simple Twitter snowflake generator and parser. |