gin-lib

command module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2023 License: MIT Imports: 3 Imported by: 0

README

gin-lib

Description

Go application framework practice based on gin framework Provides common components and functionality out of the box

Installation

go get github.com/liziwei01/gin-lib

Usage

logit
package yourpackage

import (
	"context"
	"github.com/liziwei01/gin-lib/library/logit"
)

// some sample output
// TRACE: 2023-11-01 07:38:36 /Users/liziwei01/Desktop/OpenSource/github.com/gin-lib/library/logit/logit_test.go:29 keyT[valueT] message[test trace]
// NOTICE: 2023-11-01 07:38:36 /Users/liziwei01/Desktop/OpenSource/github.com/gin-lib/library/logit/logit_test.go:30 keyN[valueN] message[test notice]

// WARNING: 2023-11-01 07:38:36 /Users/liziwei01/Desktop/OpenSource/github.com/gin-lib/library/logit/logit_test.go:31 keyW[valueW] message[test warning]
// ERROR: 2023-11-01 07:38:36 /Users/liziwei01/Desktop/OpenSource/github.com/gin-lib/library/logit/logit_test.go:32 keyE[valueE] message[test error]

func main() {
	// Set the default logger before use
	ctx := context.Background()
	SetServiceLogger(ctx)
	YourFunc(ctx)
}


func YourFunc(ctx context.Context) {
	logit.SvrLogger.Trace(ctx, "test trace", String("DebugTraceKey", "DebugOutput"))
	logit.SvrLogger.Notice(ctx, "test notice", Int("time", 1))

	err := fmt.Errorf("we got error!")
	logit.SvrLogger.Warning(ctx, "test warning", Error("err", err))
	logit.SvrLogger.Error(ctx, "test error", Error("fatal", err))
}

Documentation

Overview

* @Author: liziwei01 * @Date: 2021-04-19 15:00:00 * @LastEditTime: 2023-05-13 05:01:37 * @LastEditors: liziwei01 * @Description: main * @FilePath: /github.com/liziwei01/gin-lib/main.go

Directories

Path Synopsis
* @Author: liziwei01 * @Date: 2022-03-03 16:04:06 * @LastEditors: liziwei01 * @LastEditTime: 2023-10-30 16:42:00 * @Description: 读取配置文件, 初始化路由
* @Author: liziwei01 * @Date: 2022-03-03 16:04:06 * @LastEditors: liziwei01 * @LastEditTime: 2023-10-30 16:42:00 * @Description: 读取配置文件, 初始化路由
library
conf
* @Author: liziwei01 * @Date: 2022-03-04 15:41:55 * @LastEditors: liziwei01 * @LastEditTime: 2022-03-04 16:03:38 * @Description: 配置文件读取前置处理
* @Author: liziwei01 * @Date: 2022-03-04 15:41:55 * @LastEditors: liziwei01 * @LastEditTime: 2022-03-04 16:03:38 * @Description: 配置文件读取前置处理
cookie
* @Author: liziwei01 * @Date: 2022-06-28 00:58:59 * @LastEditors: liziwei01 * @LastEditTime: 2022-06-28 01:04:46 * @Description: file content
* @Author: liziwei01 * @Date: 2022-06-28 00:58:59 * @LastEditors: liziwei01 * @LastEditTime: 2022-06-28 01:04:46 * @Description: file content
email
* @Author: liziwei01 * @Date: 2022-03-04 15:43:21 * @LastEditors: liziwei01 * @LastEditTime: 2023-11-01 11:18:11 * @Description: file content
* @Author: liziwei01 * @Date: 2022-03-04 15:43:21 * @LastEditors: liziwei01 * @LastEditTime: 2023-11-01 11:18:11 * @Description: file content
env
* @Author: liziwei01 * @Date: 2022-03-04 15:41:36 * @LastEditors: liziwei01 * @LastEditTime: 2022-03-04 16:05:23 * @Description: 默认环境
* @Author: liziwei01 * @Date: 2022-03-04 15:41:36 * @LastEditors: liziwei01 * @LastEditTime: 2022-03-04 16:05:23 * @Description: 默认环境
extension/fileclean
go:build linux
go:build linux
extension/pool
* @Author: liziwei01 * @Date: 2023-10-31 20:12:46 * @LastEditors: liziwei01 * @LastEditTime: 2023-10-31 20:12:54 * @Description: Package pool 提供一个 BytesPool,每次可以拿到一个 *bytes.Buffer,同时提供一个全局的 GlobalBytesPool 供公共使用。
* @Author: liziwei01 * @Date: 2023-10-31 20:12:46 * @LastEditors: liziwei01 * @LastEditTime: 2023-10-31 20:12:54 * @Description: Package pool 提供一个 BytesPool,每次可以拿到一个 *bytes.Buffer,同时提供一个全局的 GlobalBytesPool 供公共使用。
extension/timer
* @Author: liziwei01 * @Date: 2023-10-31 20:07:09 * @LastEditors: liziwei01 * @LastEditTime: 2023-11-01 11:34:07 * @Description: 定时器
* @Author: liziwei01 * @Date: 2023-10-31 20:07:09 * @LastEditors: liziwei01 * @LastEditTime: 2023-11-01 11:34:07 * @Description: 定时器
extension/writer
* @Author: liziwei01 * @Date: 2023-10-31 21:56:25 * @LastEditors: liziwei01 * @LastEditTime: 2023-10-31 21:56:26 * @Description: 异步写入,而不是立刻写入,可以节约cpu资源,提高性能
* @Author: liziwei01 * @Date: 2023-10-31 21:56:25 * @LastEditors: liziwei01 * @LastEditTime: 2023-10-31 21:56:26 * @Description: 异步写入,而不是立刻写入,可以节约cpu资源,提高性能
jwtoken
* @Author: liziwei01 * @Date: 2022-04-13 23:40:04 * @LastEditors: liziwei01 * @LastEditTime: 2022-04-13 23:45:07 * @Description: file content
* @Author: liziwei01 * @Date: 2022-04-13 23:40:04 * @LastEditors: liziwei01 * @LastEditTime: 2022-04-13 23:45:07 * @Description: file content
logit
* @Author: liziwei01 * @Date: 2022-03-04 15:40:52 * @LastEditors: liziwei01 * @LastEditTime: 2023-10-31 14:43:00 * @Description: 提供默认Service Logger
* @Author: liziwei01 * @Date: 2022-03-04 15:40:52 * @LastEditors: liziwei01 * @LastEditTime: 2023-10-31 14:43:00 * @Description: 提供默认Service Logger
mysql
* @Author: liziwei01 * @Date: 2022-03-04 15:43:21 * @LastEditors: liziwei01 * @LastEditTime: 2023-11-01 11:22:02 * @Description: file content
* @Author: liziwei01 * @Date: 2022-03-04 15:43:21 * @LastEditors: liziwei01 * @LastEditTime: 2023-11-01 11:22:02 * @Description: file content
oss
* @Author: liziwei01 * @Date: 2022-03-04 15:43:21 * @LastEditors: liziwei01 * @LastEditTime: 2023-11-01 11:19:13 * @Description: file content
* @Author: liziwei01 * @Date: 2022-03-04 15:43:21 * @LastEditors: liziwei01 * @LastEditTime: 2023-11-01 11:19:13 * @Description: file content
redis
* @Author: liziwei01 * @Date: 2022-03-04 15:43:21 * @LastEditors: liziwei01 * @LastEditTime: 2023-11-01 11:19:03 * @Description: file content
* @Author: liziwei01 * @Date: 2022-03-04 15:43:21 * @LastEditors: liziwei01 * @LastEditTime: 2023-11-01 11:19:03 * @Description: file content
request
* @Author: liziwei01 * @Date: 2023-10-28 12:26:10 * @LastEditors: liziwei01 * @LastEditTime: 2023-11-01 09:48:50 * @Description: file content
* @Author: liziwei01 * @Date: 2023-10-28 12:26:10 * @LastEditors: liziwei01 * @LastEditTime: 2023-11-01 09:48:50 * @Description: file content
response
* @Author: liziwei01 * @Date: 2022-03-03 19:55:32 * @LastEditors: liziwei01 * @LastEditTime: 2022-03-10 20:49:12 * @Description: 通过错误码表示错误
* @Author: liziwei01 * @Date: 2022-03-03 19:55:32 * @LastEditors: liziwei01 * @LastEditTime: 2022-03-10 20:49:12 * @Description: 通过错误码表示错误
tinycache
* @Author: liziwei01 * @Date: 2022-03-04 15:43:21 * @LastEditors: liziwei01 * @LastEditTime: 2023-11-01 11:18:41 * @Description: file content
* @Author: liziwei01 * @Date: 2022-03-04 15:43:21 * @LastEditors: liziwei01 * @LastEditTime: 2023-11-01 11:18:41 * @Description: file content
utils
* @Author: liziwei01 * @Date: 2022-03-03 19:52:24 * @LastEditors: liziwei01 * @LastEditTime: 2023-10-28 14:12:00 * @Description:
* @Author: liziwei01 * @Date: 2022-03-03 19:52:24 * @LastEditors: liziwei01 * @LastEditTime: 2023-10-28 14:12:00 * @Description:
* @Author: liziwei01 * @Date: 2022-04-12 21:54:39 * @LastEditors: liziwei01 * @LastEditTime: 2022-04-13 23:16:09 * @Description: file content
* @Author: liziwei01 * @Date: 2022-04-12 21:54:39 * @LastEditors: liziwei01 * @LastEditTime: 2022-04-13 23:16:09 * @Description: file content

Jump to

Keyboard shortcuts

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