core

package
v1.0.80 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureNonNilArr

func EnsureNonNilArr[T any](arr []T) []T

func HandleError

func HandleError(c *gin.Context, err error)

func IsFloat

func IsFloat(v *reflect.Value) bool

func IsInt

func IsInt(v *reflect.Value) bool

func IsUint

func IsUint(v *reflect.Value) bool

func NewHTTPError

func NewHTTPError(code int, err error) error

func NewHTTPErrorStr

func NewHTTPErrorStr(code int, message string) error

func ResponseArr

func ResponseArr[T any](c *gin.Context, statusCode int, data []T)

func ResponseCreatedArr

func ResponseCreatedArr[T any](c *gin.Context, data []T)

func ResponseErr

func ResponseErr(c *gin.Context, httpStatusCode int, err ...error)

func ResponseErrStr

func ResponseErrStr(c *gin.Context, httpStatusCode int, message ...string)

func ResponseOKArr

func ResponseOKArr[T any](c *gin.Context, data []T)

Types

type APPContext

type APPContext struct {
	GithubAppSettings *models.GitHubAppSettings
	ServiceMap        map[string]interface{}
	Config            *config.Config
	GithubAppClient   *github.Client
	RepoBasePath      string
	LogDirPath        string
	Version           string
	CookieDomain      string
}

func (*APPContext) MustGetService

func (c *APPContext) MustGetService(name string) interface{}

func (*APPContext) RegisterService

func (c *APPContext) RegisterService(name string, service interface{})

type ArrayResponse

type ArrayResponse[T any] struct {
	Data       []T `json:"entries"`
	EntryCount int `json:"entryCount"`
}

func NewArrayResponse

func NewArrayResponse[T any](data []T) ArrayResponse[T]

type ErrorMessage

type ErrorMessage struct {
	Message string `json:"message"`
}

func NewErrorMessage

func NewErrorMessage(err ...error) []ErrorMessage

func NewErrorMessageStr

func NewErrorMessageStr(err ...string) []ErrorMessage

type ErrorMessageDTO

type ErrorMessageDTO struct {
	HttpStatusCode int            `json:"httpStatusCode"`
	ErrorMessages  []ErrorMessage `json:"errorMessages"`
}

func NewErrorMessageDTO

func NewErrorMessageDTO(httpStatusCode int, err ...error) ErrorMessageDTO

func NewErrorMessageDTOStr

func NewErrorMessageDTOStr(httpStatusCode int, message ...string) ErrorMessageDTO

type HTTPError

type HTTPError struct {
	StatusCode int
	Message    string
}

func NewGormHTTPError

func NewGormHTTPError(err error) *HTTPError

func (*HTTPError) Error

func (e *HTTPError) Error() string

type ParamDef

type ParamDef struct {
	// contains filtered or unexported fields
}

func (*ParamDef) Handle

func (p *ParamDef) Handle(c *gin.Context) error

func (*ParamDef) Int64

func (p *ParamDef) Int64() (int64, error)

func (*ParamDef) SetError

func (p *ParamDef) SetError(code int, errorMsg string) *ParamDef

func (*ParamDef) String

func (p *ParamDef) String() string

func (*ParamDef) UInt64

func (p *ParamDef) UInt64() (uint64, error)

func (*ParamDef) Value

func (p *ParamDef) Value() any

type RequestParam

type RequestParam struct {
	Params map[string]*ParamDef
}

func NewRequestParam

func NewRequestParam() *RequestParam

func (*RequestParam) AddContextParam

func (p *RequestParam) AddContextParam(name string, empty bool, pattern *regexp.Regexp) *ParamDef

func (*RequestParam) AddCookieParam

func (p *RequestParam) AddCookieParam(name string, empty bool, pattern *regexp.Regexp) *ParamDef

func (*RequestParam) AddQueryParam

func (p *RequestParam) AddQueryParam(name string, empty bool, pattern *regexp.Regexp) *ParamDef

func (*RequestParam) AddUrlParam

func (p *RequestParam) AddUrlParam(name string, empty bool, pattern *regexp.Regexp) *ParamDef

func (*RequestParam) Handle

func (p *RequestParam) Handle(c *gin.Context) error

func (*RequestParam) HandleWithBody

func (p *RequestParam) HandleWithBody(c *gin.Context, body interface{}) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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