demo

package
v0.0.0-...-bfe4a9d Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const BusiAPI = "/api/busi"
View Source
const BusiPort = 8081
View Source
const DataKey = "key1"

Variables

View Source
var BusiApp = gin.Default()
View Source
var BusiUrl = fmt.Sprintf("http://localhost:%d%s", BusiPort, BusiAPI)
View Source
var DtmServer = "http://localhost:36789/api/dtmsvr"

Functions

func DeleteCacheValue

func DeleteCacheValue(key string)

func Exec

func Exec(tx *sql.Tx, sql string, args ...interface{}) (sql.Result, error)

func Fetch

func Fetch(mode string, key string, expire time.Duration, fn func() (string, error)) (string, error)

func Get

func Get(url string) *resty.Response

func GetCacheValue

func GetCacheValue(key string, mode string) string

func Main

func Main()

func MustMapBodyFrom

func MustMapBodyFrom(c *gin.Context) map[string]interface{}

func NormalFetch

func NormalFetch(key string, expire time.Duration, fn func() (string, error)) (string, error)

func Post

func Post(url string, body map[string]interface{}) *resty.Response

func QueryRow

func QueryRow(db *sql.DB, sql string, args ...interface{}) *sql.Row

func SetCacheValue

func SetCacheValue(key string, value string, mode string)

func SetDBValue

func SetDBValue(row *DBRow)

func UpdateInTx

func UpdateInTx(tx *sql.Tx, row *DBRow) error

Types

type DBRow

type DBRow struct {
	K        string
	V        string
	TimeCost string
}

func GetDBValue

func GetDBValue(key string) DBRow

Jump to

Keyboard shortcuts

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