lib

package
v0.0.0-...-476b199 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2023 License: LGPL-3.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

View Source
const ATK_SITE_ALL = "__ATK_SITE_ALL"

所有站点

View Source
const COOKIE_KEY_ATK_AUTH = "ATK_AUTH"

Cookie 键

View Source
const CTX_KEY_ATK_SITE_ALL = "atk_site_all"
View Source
const CTX_KEY_ATK_SITE_ID = "atk_site_id"

ctx keys

View Source
const CTX_KEY_ATK_SITE_NAME = "atk_site_name"

Variables

View Source
var (
	Version    string
	CommitHash string
)

版本信息

View Source
var DB *gorm.DB
View Source
var FeMinVersion string = "2.4.3"

前端最小要求版本号

Functions

func AddQueryToURL

func AddQueryToURL(urlStr string, queryMap map[string]string) string

func ContainsStr

func ContainsStr(s []string, v string) bool

ContainsStr returns true if an str is present in a iteratee.

func EnsureDir

func EnsureDir(dir string) error

EnsureDir ensures that a target directory exists (like `mkdir -p`),

func GetMD5Hash

func GetMD5Hash(text string) string

func InitDB

func InitDB()

func JsonObjInArrAnyStr

func JsonObjInArrAnyStr(jsonStr string) string

将 JSON "数组中的"对象的 Values 全部转成 String 类型 @note Array style is not the same as JSON Array, it uses the ToString() function.

[{"a":233}, {"b":true}, {"c":"233"}]
=> [{"a":"233"}, {"b":"true"}, {"c":"233"}]

@relevant ToString()

func Marked

func Marked(markdownStr string) (string, error)

func NewGormLogger

func NewGormLogger() *gLogger

func OpenCache

func OpenCache() (err error)

func OpenDB

func OpenDB(dbType config.DBType, dsn string) (*gorm.DB, error)

func OpenMySql

func OpenMySql(dsn string) (*gorm.DB, error)

func OpenPostgreSQL

func OpenPostgreSQL(dsn string) (*gorm.DB, error)

func OpenSQLite

func OpenSQLite(filename string) (*gorm.DB, error)

func OpenSqlServer

func OpenSqlServer(dsn string) (*gorm.DB, error)

func RemoveBlankStrings

func RemoveBlankStrings(s []string) []string

func RemoveDuplicates

func RemoveDuplicates(arr []string) []string

RemoveDuplicates removes the duplicates strings from a Slice

func SplitAndTrimSpace

func SplitAndTrimSpace(s string, sep string) []string

func StructToFlatDotMap

func StructToFlatDotMap(s interface{}) map[string]interface{}

func StructToMap

func StructToMap(s interface{}) map[string]interface{}

func ToString

func ToString(val interface{}) string

任何类型转 String

(bool) true => (string) "true"
(int) 0 => (string) "0"

func TruncateString

func TruncateString(str string, length int) string

func ValidateEmail

func ValidateEmail(email string) bool

func ValidateURL

func ValidateURL(url string) bool

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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