utils

package
v0.0.0-...-faa1211 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package utils ...

Package utils xxx

Index

Constants

View Source
const (
	// FSType file system type
	FSType = "ext[234]|btrfs|xfs|zfs"
	// MountPoint mount point
	MountPoint = "/data"
)
View Source
const (
	// DataTableNamePrefix xxx
	DataTableNamePrefix = "bcsmonitor_"
)
View Source
const (

	// QueryFallbackTime metrics 查询回退时间
	QueryFallbackTime = time.Minute
)

Variables

This section is empty.

Functions

func EnsureTable

func EnsureTable(ctx context.Context, db drivers.DB, tableName string, indexes []drivers.Index) error

EnsureTable ensure object database table and table indexes

func GetIPv6AddrFromEnv

func GetIPv6AddrFromEnv() string

GetIPv6AddrFromEnv 解析ipv6

func GetListenAddr

func GetListenAddr(addr, port string) string

GetListenAddr xxx

func GetNowQueryTime

func GetNowQueryTime() time.Time

GetNowQueryTime 获取当前时间

func StringInSlice

func StringInSlice(str string, list []string) bool

StringInSlice 判断字符串是否存在 Slice 中

func StringJoinIPWithRegex

func StringJoinIPWithRegex(list []string, sep, reg string) string

StringJoinIPWithRegex 数组转化为字符串,并添加正则

func StringJoinWithRegex

func StringJoinWithRegex(list []string, sep, reg string) string

StringJoinWithRegex 数组转化为字符串,并添加正则

Types

type JSONTime

type JSONTime struct {
	time.Time
}

JSONTime format time in json marshal

func (*JSONTime) MarshalJSON

func (t *JSONTime) MarshalJSON() ([]byte, error)

MarshalJSON marshal json

func (*JSONTime) UnmarshalJSON

func (t *JSONTime) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshal json

type ListOption

type ListOption struct {
	// Sort map for sort list results
	Sort map[string]interface{}

	// Page for the page number in current list
	Page int64

	// Size for the size each page in current list
	Size int64
}

ListOption list option the listed data index is from page*size ~ page*size+(size-1)

Jump to

Keyboard shortcuts

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