Documentation ¶
Index ¶
- Variables
- func InitLog(cnf *ServerConf) error
- func InitMysql(addr, user, password, database string) error
- func InitPg(addr, user, password, database string) error
- func New(res http.ResponseWriter, req *http.Request, r T, methods ...string)
- func RunServer(addr string, handler http.Handler) error
- func Write(res http.ResponseWriter, req *http.Request, code int, data interface{})
- type CacheConf
- type DbConf
- type HttpConf
- type HttpTest
- type ListOptions
- type LoggerHandler
- type Server
- type ServerConf
- type T
Constants ¶
This section is empty.
Variables ¶
View Source
var Db *sql.DB
View Source
var Log = logrus.New()
Functions ¶
func InitLog ¶
func InitLog(cnf *ServerConf) error
Types ¶
type ListOptions ¶
type ListOptions struct { // For paginated result sets, page of results to retrieve. Offset int64 `url:"offset,omitempty"` // For paginated result sets, the number of results to include per page. Limit int64 `url:"limit,omitempty"` }
ListOptions specifies the optional parameters to various List methods that support pagination.
type LoggerHandler ¶
type LoggerHandler struct{}
func NewLoggerHandler ¶
func NewLoggerHandler() *LoggerHandler
NewLoggerHandler returns a new LoggerHandler instance
func (*LoggerHandler) ServeHTTP ¶
func (*LoggerHandler) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc)
type ServerConf ¶
type ServerConf struct { AccessLog string `yaml:"access_log"` ErrorLog string `yaml:"error_log"` LogLevel string `yaml:"log_level"` Http *HttpConf `yaml:"http"` Db *DbConf `yaml:"db"` Cache *CacheConf `yaml:"cache"` }
var Conf *ServerConf
func InitServerConf ¶
func InitServerConf(file string) (*ServerConf, error)
Click to show internal directories.
Click to hide internal directories.