server

package
v0.0.0-...-3cc3e56 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2023 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRecordWindows

func GetRecordWindows(c *gin.Context, queryStruct pageQuery) (start, size int, err error)

func Logger

func Logger(c *gin.Context) *logrus.Logger

Types

type ApiCreateData

type ApiCreateData struct {
	DB                    string                 `json:"db"`
	ID                    uint                   `json:"id"`
	Name                  string                 `json:"name"`
	Method                string                 `json:"method"`
	ApiType               string                 `json:"apiType"`
	Description           string                 `json:"description"`
	SqlType               string                 `json:"sqlType"` // template chain
	SqlTemplate           map[string]string      `json:"sqlTemplate"`
	SqlTemplateParameters map[string]interface{} `json:"sqlTemplateParameters"`
	SqlTemplateResult     map[string]interface{} `json:"sqlTemplateResult"`
}

type CheckApiRequest

type CheckApiRequest func(c *gin.Context, apiType string) bool

type GetRequestMoreData

type GetRequestMoreData func() map[string]interface{}

type QueryParams

type QueryParams map[string]interface{}

func (QueryParams) GetTest

func (q QueryParams) GetTest() (bool, error)

type ResInterface

type ResInterface interface {
	CodeTag() string
	MessageTag() string
	DataTag() string
}

type ResponseMsg

type ResponseMsg struct {
	ErrorCode int         `json:"errno"`
	ErrorMsg  string      `json:"errmsg"`
	Data      interface{} `json:"data"`
	// contains filtered or unexported fields
}

func (*ResponseMsg) CodeTag

func (r *ResponseMsg) CodeTag() string

func (*ResponseMsg) DataTag

func (r *ResponseMsg) DataTag() string

func (ResponseMsg) MarshalJSON

func (r ResponseMsg) MarshalJSON() ([]byte, error)

func (*ResponseMsg) MessageTag

func (r *ResponseMsg) MessageTag() string

func (*ResponseMsg) New

func (r *ResponseMsg) New() *ResponseMsg

func (*ResponseMsg) WithTag

func (r *ResponseMsg) WithTag(tag ResInterface)

type Server

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

func NewServer

func NewServer(logger *logrus.Logger, addr, prefix string) *Server

func (*Server) AdminMiddleware

func (s *Server) AdminMiddleware(m gin.HandlerFunc)

func (*Server) ApiCreate

func (s *Server) ApiCreate(c *gin.Context)

func (*Server) ApiDelete

func (s *Server) ApiDelete(c *gin.Context)

func (*Server) ApiGet

func (s *Server) ApiGet(c *gin.Context)

func (*Server) ApiList

func (s *Server) ApiList(c *gin.Context)

func (*Server) GetRouterGroup

func (s *Server) GetRouterGroup(prefix string) *gin.RouterGroup

get gin router group

func (*Server) ProxyList

func (s *Server) ProxyList(c *gin.Context)

func (*Server) Query

func (s *Server) Query(c *gin.Context)

query for type template

func (*Server) QueryMiddleware

func (s *Server) QueryMiddleware(m ...gin.HandlerFunc)

middleware for query api

func (*Server) RegisterBindValidator

func (r *Server) RegisterBindValidator(tag string, fn validator.Func, callValidationEvenIfNull ...bool)

add custom validation

func (*Server) RegisterTemplateFunction

func (r *Server) RegisterTemplateFunction(funcMap template.FuncMap)

add template functions

func (*Server) Run

func (s *Server) Run(g *run.Group)

func (*Server) WithCheckApinRequest

func (s *Server) WithCheckApinRequest(f CheckApiRequest)

check api type auth

func (*Server) WithTag

func (r *Server) WithTag(tag ResInterface)

Jump to

Keyboard shortcuts

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