types

package
v1.6.40 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultApp = &App{
	Name: "demo",
	Mode: consts.DevMode,
	Version: &Version{
		Latest: "1.0.0",
		Key:    "app_version",
	},
	Session: &Session{
		Key:        "sess_token",
		KeyPrefix:  "ci_session:",
		Expiration: 6 * 30 * 86400,
	},
	Logger: &Logger{
		Dir:         "apps/logs/go/demo",
		LogTimeout:  10 * time.Second,
		SendTimeout: 5 * time.Second,
	},
	Sign: &Sign{
		SecretKey:  "1234!@#$",
		Key:        "sess_token",
		TimeKey:    "utime",
		Dev:        "zgin-dev-sign",
		Expiration: 60,
	},
	Server: &Server{
		Addr:            "0.0.0.0:9999",
		ReadTimeout:     10 * time.Second,
		WriteTimeout:    15 * time.Second,
		ShutDownTimeout: 15 * time.Second,
	},
}

Functions

This section is empty.

Types

type App added in v1.5.0

type App struct {
	Name    string
	Mode    string
	Version *Version
	Logger  *Logger
	Server  *Server
	Sign    *Sign
	Session *Session
}

func (*App) GetSession added in v1.5.0

func (a *App) GetSession() (clientFunc func() *redis.Client, key, prefix string, expiration int64)

func (*App) GetSign added in v1.5.0

func (a *App) GetSign() (secretKey, key, timeKey, dev string, expiration int64)

func (*App) GetVersion added in v1.5.0

func (a *App) GetVersion() (version, key string)

func (*App) Run added in v1.5.0

func (a *App) Run(options ...func(app *App))

func (*App) SetMode added in v1.5.0

func (a *App) SetMode(mode string) *App

type Controller added in v1.4.2

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

func (*Controller) Context added in v1.6.8

func (c *Controller) Context(ctx ...*gin.Context) *gin.Context

func (*Controller) DumpRequest added in v1.4.2

func (c *Controller) DumpRequest() string

func (*Controller) GetContext added in v1.6.0

func (c *Controller) GetContext() *gin.Context

func (*Controller) GetLoggedUserId added in v1.4.2

func (c *Controller) GetLoggedUserId() int

func (*Controller) GetQueryByMethod added in v1.4.2

func (c *Controller) GetQueryByMethod(key, defaultValue string) string

func (*Controller) GetQueryPostForm added in v1.4.2

func (c *Controller) GetQueryPostForm(keys ...string) string

func (*Controller) Json added in v1.4.2

func (c *Controller) Json(a ...interface{})

func (*Controller) PostForm added in v1.5.4

func (c *Controller) PostForm(keys ...string) string

func (*Controller) Query added in v1.5.4

func (c *Controller) Query(keys ...string) string

func (*Controller) QueryPostNumber added in v1.5.4

func (c *Controller) QueryPostNumber(key string, defaultValue ...int) int

func (*Controller) SetContext added in v1.4.2

func (c *Controller) SetContext(ctx *gin.Context)

func (*Controller) TraceId added in v1.6.8

func (c *Controller) TraceId() string

type ICheck added in v1.4.2

type ICheck interface {
	GetVersion() (version, key string)
	GetSign() (secretKey, key, timeKey, dev string, expiration int64)
	GetSession() (fn func() *redis.Client, key, prefix string, expiration int64)
}

type IController added in v1.4.2

type IController interface {
	SetContext(*gin.Context)
}

type Logger added in v1.5.0

type Logger struct {
	Dir         string
	LogTimeout  time.Duration
	SendTimeout time.Duration
}

type Model added in v1.4.2

type Model struct {
	mysql.Model
}

type Redis added in v1.4.2

type Redis struct {
	redis.Redis
}

type RestHandler added in v1.4.2

type RestHandler struct {
	Sort    int
	Sign    bool
	Login   bool
	Path    string
	Version RestVersion
	Http    string
	Method  string
	Https   map[string]byte
	Handler IController
}

type RestHandlers added in v1.4.2

type RestHandlers []*RestHandler

type RestVersion added in v1.6.0

type RestVersion struct {
	Plus  bool
	Value string
}

type Restful added in v1.4.2

type Restful map[string]RestHandlers

type Sender added in v1.5.4

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

func (*Sender) Always added in v1.5.4

func (s *Sender) Always() bool

func (*Sender) Open added in v1.5.4

func (s *Sender) Open() bool

func (*Sender) Push added in v1.5.4

func (s *Sender) Push(msg string)

type Server added in v1.5.0

type Server struct {
	Addr            string
	ReadTimeout     time.Duration
	WriteTimeout    time.Duration
	ShutDownTimeout time.Duration
	Http            *http.Server
}

type Session

type Session struct {
	Key        string
	KeyPrefix  string
	Expiration int64
	ClientFunc func() *redis.Client
}

type Sign added in v1.5.0

type Sign struct {
	SecretKey  string
	Key        string
	TimeKey    string
	Dev        string
	Expiration int64
}

type Version added in v1.5.0

type Version struct {
	Latest, Key string
}

Jump to

Keyboard shortcuts

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