utils

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2021 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrCode0101 = "ORT0101" // Internal Error
	ErrCode0107 = "ORT0107" // Illegal Param
	ErrCode0108 = "ORT0108" // Illegal DiceYml
	ErrCode0109 = "ORT0109" // Cluster Not Found
	ErrCode0110 = "ORT0110" // 正在部署中,请不要重复部署
	ErrCode0111 = "ORT0111" // not login

	// TODO: fresh new code definitions
	RuntimeNotFound = "RuntimeNotFound"
)

Variables

This section is empty.

Functions

func AppendEnv

func AppendEnv(target map[string]string, overlay map[string]string)

func ApplyOverlay

func ApplyOverlay(d *diceyml.Object, overlay *diceyml.Object)

func BuildDiscoveryConfig

func BuildDiscoveryConfig(appName string, group *apistructs.ServiceGroup) map[string]string

func BuildVolumeRootDir

func BuildVolumeRootDir(runtime *dbclient.Runtime) string

func ConvertBinds

func ConvertBinds(volumePrefixDir string, vol []string) (binds []apistructs.ServiceBind)

func ConvertHealthCheck

func ConvertHealthCheck(hc spec.HealthCheck) *apistructs.NewHealthCheck

func ConvertServiceLabels

func ConvertServiceLabels(groupLabels, serviceLabels map[string]string, serviceName string) map[string]string

func ConvertToLegacyDice

func ConvertToLegacyDice(dice *diceyml.DiceYaml, addonActions map[string]interface{}) *spec.LegacyDice

func DoJson

func DoJson(r *httpclient.Request, o interface{}) error

func ErrResp

func ErrResp(status int, err *apistructs.ErrorResponse) (httpserver.Responser, error)

func ErrResp0101

func ErrResp0101(err error, msg string) (httpserver.Responser, error)

func ErrRespIllegalParam

func ErrRespIllegalParam(err error, msg string) (httpserver.Responser, error)

func GetPageInfo

func GetPageInfo(r *http.Request) (apistructs.PageInfo, error)

func Round

func Round(f float64, n int) float64

Round 保留小数点计算

func Smaller

func Smaller(a, b float64) bool

Types

type ErrCode

type ErrCode string

type Resp

type Resp struct {
	Success bool                      `json:"success"`
	Data    interface{}               `json:"data,omitempty"`
	Err     *apistructs.ErrorResponse `json:"err,omitempty"`
}

type RespForRead

type RespForRead struct {
	Success bool                      `json:"success"`
	Data    json.RawMessage           `json:"data,omitempty"`
	Err     *apistructs.ErrorResponse `json:"err,omitempty"`
}

Jump to

Keyboard shortcuts

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