Back to godoc.org

Package app

v0.0.0-...-c6e1f3d
Latest Go to latest

The latest major version is .

Published: Sep 18, 2020 | License: MIT | Module: github.com/ZYallers/gin-framework/gin

Overview

Copyright (c) 2020 HXS R&D Technologies, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

@Title main @Description Description

@Author zhongyongbiao 2020/9/4 下午2:05 @Version 1.0.0 @Software hxsapp-base-gin

Copyright (c) 2020 HXS R&D Technologies, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

@Title session @Description

@Author zhongyongbiao @Version 1.0.0 @Time 2020/7/14 下午2:45 @Software GoLand

Index

Variables

var (
	Name                  = "gin-framework"
	Version               = "1.0.0"
	HttpServerDefaultAddr = "0.0.0.0:9010"
	LogDir                = "/apps/logs/go/gin-framework"
	ErrorRobotToken       = ""
	GracefulRobotToken    = ""

	HttpServerAddr *string
	Engine         *gin.Engine
	Logger         *zap.Logger
	DebugStack     bool
	RobotEnable    bool

	ReqStrKey = "gin-gonic/gin/reqstr"
	TokenKey  = ""
)
var (
	DB = map[string]MysqlDialect{
		"test": {
			Host: os.Getenv("mysql_test_host"),
			User: os.Getenv("mysql_test_username"),
			Pwd:  os.Getenv("mysql_test_password"),
			Db:   os.Getenv("mysql_test_database"),
			Port: os.Getenv("mysql_test_port"),
		},
	}
)
var (
	Redis = RedisClientKey{
		Client: map[string]RedisClient{
			"cache": {
				Host: os.Getenv("redis_host"),
				Port: os.Getenv("redis_port"),
				Pwd:  os.Getenv("redis_password"),
				Db:   0,
			},
			"session": {
				Host: os.Getenv("redis_session_host"),
				Port: os.Getenv("redis_session_port"),
				Pwd:  os.Getenv("redis_session_password"),
				Db:   0,
			},
		},
		Key: redisKey{
			Session: session{
				StringSessToken: "ci_session:",
			},
		},
	}
)
var Session = SessionConfig{
	TokenKey:       "gin-gonic/gin/sesstoken",
	DataKey:        "gin-gonic/gin/sessdata",
	LoggedUidKey:   "gin-gonic/gin/loggeduserid",
	UpdateDuration: 5 * time.Minute,
	Expiration:     6 * 30 * 86400,
}

func ServerRun

func ServerRun()

type MysqlDialect

type MysqlDialect struct {
	User, Pwd, Host, Port, Db string
}

type RedisClient

type RedisClient struct {
	Host, Port, Pwd string
	Db              int
}

type RedisClientKey

type RedisClientKey struct {
	Client map[string]RedisClient
	Key    redisKey
}

type SessionConfig

type SessionConfig struct {
	TokenKey, DataKey, LoggedUidKey string
	UpdateDuration                  time.Duration
	Expiration                      int64
}

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier