common

package
v0.0.0-...-8d187f3 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ClusterIDRegex = regexp.MustCompile("^[0-9a-zA-Z][-0-9a-zA-Z]{0,31}$")

Functions

func BadRequestResponse

func BadRequestResponse(c *gin.Context, optStatus string, description string)

func CheckClusterID

func CheckClusterID(clusterID string) bool

func CheckJSONParam

func CheckJSONParam(jsonString string, v interface{}) error

CheckJSONParam check json parameters for redundancy. Does not support map[string]interface type in struct.

func ForwardMasterController

func ForwardMasterController(c *gin.Context, masterControllerName string, port int)

func GetAllKeys

func GetAllKeys(jsonString string) (map[string]bool, error)

GetAllKeys gets all json keys. Does not support map[string]interface type in struct.

func GetContextOrgDB

func GetContextOrgDB(ctx *gin.Context) (*mysql.DB, error)

func GetContextOrgID

func GetContextOrgID(ctx *gin.Context) (int, error)

func GetJsonTags

func GetJsonTags(v interface{}) map[string]bool

GetJsonTags get all json tags of struct. Does not support map[string]interface type in struct.

func HttpResponse

func HttpResponse(c *gin.Context, httpCode int, data interface{}, optStatus string, description string)

func InternalErrorResponse

func InternalErrorResponse(c *gin.Context, data interface{}, optStatus string, description string)

func JsonResponse

func JsonResponse(c *gin.Context, data interface{}, err error)

func ServiceUnavailableResponse

func ServiceUnavailableResponse(c *gin.Context, data interface{}, optStatus string, description string)

func StatusForbiddenResponse

func StatusForbiddenResponse(c *gin.Context, description string)

func StatusPartialContentResponse

func StatusPartialContentResponse(c *gin.Context, data interface{}, optStatus string, description string)

Types

type Response

type Response struct {
	OptStatus   string      `json:"OPT_STATUS"`
	Description string      `json:"DESCRIPTION"`
	Data        interface{} `json:"DATA"`
}

Jump to

Keyboard shortcuts

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