pkg

package
v1.7.6 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2026 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TextBlack = iota + 30
	TextRed
	TextGreen
	TextYellow
	TextBlue
	TextMagenta
	TextCyan
	TextWhite
)
View Source
const (
	TrafficKey = "X-Request-Id"
	LoggerKey  = "_jxt-logger-request"
)

Variables

This section is empty.

Functions

func Assert

func Assert(condition bool, msg string, code ...int)

Assert 条件断言 当断言条件为 假 时触发 panic 对于当前请求不会再执行接下来的代码,并且返回指定格式的错误信息和错误码

func Black

func Black(msg string) string

func Blue

func Blue(msg string) string

func CompareHashAndPassword

func CompareHashAndPassword(e string, p string) (bool, error)

func Cyan

func Cyan(msg string) string

func FileCreate

func FileCreate(content bytes.Buffer, name string)

func FileMonitoringById

func FileMonitoringById(ctx context.Context, filePth string, id string, group string, hookfn func(context.Context, string, string, []byte))

func GenerateMsgIDFromContext

func GenerateMsgIDFromContext(c *gin.Context) string

GenerateMsgIDFromContext 生成msgID

func GenerateRandomKey6

func GenerateRandomKey6() string

GenerateRandomKey6 生成6为随机字符串

func GenerateRandomKey16

func GenerateRandomKey16() string

GenerateRandomKey16 生成16为随机字符串

func GenerateRandomKey20

func GenerateRandomKey20() string

GenerateRandomKey20 生成20位随机字符串

func Get

func Get(url string) (string, error)

发送GET请求 url: 请求地址 response: 请求返回的内容

func GetCurrentPath

func GetCurrentPath() string

GetCurrentPath 获取当前路径,比如:E:/abc/data/test

func GetCurrentTime

func GetCurrentTime() time.Time

func GetCurrentTimeStr

func GetCurrentTimeStr() string

func GetFileSize

func GetFileSize(filename string) int64

GetFileSize 获取文件大小

func GetLocaHonst

func GetLocaHonst() string

获取局域网ip地址

func GetLocation

func GetLocation(ip, key string) string

获取外网ip地址

func GetOrm

func GetOrm(c *gin.Context) (*gorm.DB, error)

GetOrm 获取orm连接

func Green

func Green(msg string) string

func HasError

func HasError(err error, msg string, code ...int)

HasError 错误断言 当 error 不为 nil 时触发 panic 对于当前请求不会再执行接下来的代码,并且返回指定格式的错误信息和错误码 若 msg 为空,则默认为 error 中的内容

func IdsStrToIdsIntGroup

func IdsStrToIdsIntGroup(key string, c *gin.Context) []int

获取URL中批量id并解析

func IdsStrToIdsIntGroupStr

func IdsStrToIdsIntGroupStr(keys string) []int

func Int64ToString

func Int64ToString(e int64) string

func IntToString

func IntToString(e int) string

func Magenta

func Magenta(msg string) string

func PathCreate

func PathCreate(dir string) error

func PathExist

func PathExist(addr string) bool

PathExist 判断目录是否存在

func Post

func Post(url string, data interface{}, contentType string) ([]byte, error)

发送POST请求 url: 请求地址 data: POST请求提交的数据 contentType: 请求体格式,如:application/json content: 请求放回的内容

func Red

func Red(msg string) string

func Round

func Round(f float64, n int) float64

func SetColor

func SetColor(msg string, conf, bg, text int) string

func SetPassword

func SetPassword(password string, salt string) (verify string, err error)

SetPassword 根据明文密码和加盐值生成密码

func StringToInt

func StringToInt(e string) (int, error)

func StructToJsonStr

func StructToJsonStr(e interface{}) (string, error)

func Translate

func Translate(form, to interface{})

func UIntToString

func UIntToString(e uint) string

func White

func White(msg string) string

func Yellow

func Yellow(msg string) string

Types

type Ids

type Ids struct {
	Ids []int
}

type Mode

type Mode string
const (
	ModeDev  Mode = "dev"     //开发模式
	ModeTest Mode = "test"    //测试模式
	ModeProd Mode = "prod"    //生产模式
	Mysql         = "mysql"   //mysql数据库标识
	Sqlite        = "sqlite3" //sqlite
)

func (Mode) String

func (e Mode) String() string

type ReplaceHelper

type ReplaceHelper struct {
	Root    string //路径
	OldText string //需要替换的文本
	NewText string //新的文本
}

func (*ReplaceHelper) DoWork

func (h *ReplaceHelper) DoWork() error

Directories

Path Synopsis
Package crypto 提供 AES-256-GCM 加密/解密服务
Package crypto 提供 AES-256-GCM 加密/解密服务
domain
pkg/migration/initdb.go
pkg/migration/initdb.go
Package reliable 提供可靠消费的状态机内核与持久化抽象(opus5-RCC-v2 §1~§8)。
Package reliable 提供可靠消费的状态机内核与持久化抽象(opus5-RCC-v2 §1~§8)。
adapters/eventbus
Package eventbusdlq is the core DLQ adapter bridging the jxt-core partition- pipeline DLQSender contract to the reliable store (spec §7 "handler claim 前 / transport 失败" path).
Package eventbusdlq is the core DLQ adapter bridging the jxt-core partition- pipeline DLQSender contract to the reliable store (spec §7 "handler claim 前 / transport 失败" path).
gate
Package gate 提供 aggregate-gate 的获取/释放机制(§6.2.1)。
Package gate 提供 aggregate-gate 的获取/释放机制(§6.2.1)。
lease
Package lease 周期**观测**过期 PROCESSING 租约(§3.2)。
Package lease 周期**观测**过期 PROCESSING 租约(§3.2)。
opsvc
Package opsvc 是 reliable 内核的 §10 ops 服务层(PR-2 Task B2)。
Package opsvc 是 reliable 内核的 §10 ops 服务层(PR-2 Task B2)。
replay
Package replay 实现 eligible-head 重放调度器(§6.2/§6.2.1)。
Package replay 实现 eligible-head 重放调度器(§6.2/§6.2.1)。
store
Package store 定义 reliable 持久化的方言中立抽象:Row 领域 model 与 Store 接口。
Package store 定义 reliable 持久化的方言中立抽象:Row 领域 model 与 Store 接口。
store/gormshared
Package gormshared 是 reliable Store 的共享 GORM 实现(D17)。
Package gormshared 是 reliable Store 的共享 GORM 实现(D17)。
store/mysql
Package mysql 是 reliable Store 的 MySQL 薄方言包(D17)。
Package mysql 是 reliable Store 的 MySQL 薄方言包(D17)。
store/postgres
Package postgres 是 reliable Store 的 PostgreSQL 薄方言包(D17)。
Package postgres 是 reliable Store 的 PostgreSQL 薄方言包(D17)。
store/repotest
Package repotest 是 reliable Store 的双方言共享 conformance suite(项目首创,准入 ⑭)。
Package repotest 是 reliable Store 的双方言共享 conformance suite(项目首创,准入 ⑭)。
tenant
cache
Package cache provides persistent file-based caching for tenant configuration.
Package cache provides persistent file-based caching for tenant configuration.
ftp
middleware
Package middleware provides tenant ID extraction middleware for Gin framework.
Package middleware provides tenant ID extraction middleware for Gin framework.
wvp

Jump to

Keyboard shortcuts

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