utils

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CSTZone = time.FixedZone("GMT", 8*3600)

Functions

func Contains

func Contains(strList []string, str string) bool

func ConvertTypeByJson

func ConvertTypeByJson(srcObj interface{}, destPtr interface{}) (err error)

func GetCodeRepoName

func GetCodeRepoName(codeUrl string) string

GetCodeRepoName 获取代码库的项目名 如:https://github.com/dnsjia/pipeflow.git ---> pipeflow git@github.com/dnsjia/pipeflow.git -> pipeflow

func GetImageName

func GetImageName(img string) string

GetImageName 获取镜像的名称 如:docker.io/dnsjia/pipeflow:latest -> dnsjia/pipeflow

func HandleCrash

func HandleCrash(additionalHandlers ...func(interface{}))

func LookupEnvOrInt

func LookupEnvOrInt(key string, defaultVal int) int

LookupEnvOrInt returns the value of the environment variable with the given key, or the given default value if the key is not set.

func LookupEnvOrString

func LookupEnvOrString(key string, defaultVal string) string

LookupEnvOrString returns the value of the environment variable with the given key, or the given default value if the key is not set.

func ParseImageName

func ParseImageName(img string, withDefault bool) (string, string, string)

ParseImageName 获取镜像的名称 如:docker.io/dnsjia/pipeflow:latest -> docker.io dnsjia/pipeflow latest

func ShortUUID

func ShortUUID() string

Types

type Response

type Response struct {
	Code int    `json:"code"`
	Msg  string `json:"msg"`
	Data any    `json:"data"`
}

func NewResponseWithError

func NewResponseWithError(err error) *Response

func NewResponseWithOk

func NewResponseWithOk(data any) *Response

func (*Response) IsSuccess

func (r *Response) IsSuccess() bool

func (*Response) Scan

func (r *Response) Scan(value any) error

func (Response) String

func (r Response) String() (driver.Value, error)

type WatchResponse

type WatchResponse struct {
	Event    string `json:"event"`
	Data     any    `json:"data"`
	Resource any    `json:"resource"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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