Documentation ¶
Index ¶
- func ExtractPagingParams(req *restful.Request, minPageSize, maxPageSize int) (int, int, error)
- func FirstLower(s string) string
- func FirstUpper(s string) string
- func GenerateVersion(pre string) string
- func GetDefaultUIType(apiType string, haveOptions bool, subType string, haveSub bool) string
- func RenderLabel(source interface{}) string
- func StringsContain(items []string, source string) bool
- type GatherErr
- type GroupOption
- type MemoryCache
- type Option
- type UIParameter
- type Validate
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractPagingParams ¶
ExtractPagingParams extract `page` and `pageSize` params from request
func FirstLower ¶
FirstLower Sets the first letter of the string to lowercase.
func FirstUpper ¶
FirstUpper Sets the first letter of the string to upper.
func GenerateVersion ¶
GenerateVersion Generate version numbers by time
func GetDefaultUIType ¶
GetDefaultUIType Set the default mapping for API Schema Type
func StringsContain ¶
StringsContain strings contain
Types ¶
type GroupOption ¶
GroupOption define multiple data structure composition options.
type MemoryCache ¶
type MemoryCache struct {
// contains filtered or unexported fields
}
MemoryCache memory cache, support time expired
func NewMemoryCache ¶
func NewMemoryCache(data interface{}, cacheDuration time.Duration) *MemoryCache
NewMemoryCache new memory cache instance
func (*MemoryCache) IsExpired ¶
func (m *MemoryCache) IsExpired() bool
IsExpired whether the cache data expires
type Option ¶
type Option struct { Label string `json:"label"` Value interface{} `json:"value"` }
Option select option
type UIParameter ¶
type UIParameter struct { Sort uint `json:"sort"` Label string `json:"label"` Description string `json:"description"` Validate *Validate `json:"validate,omitempty"` JSONKey string `json:"jsonKey"` UIType string `json:"uiType"` // means disable parameter in ui Disable *bool `json:"disable,omitempty"` SubParameterGroupOption []GroupOption `json:"subParameterGroupOption,omitempty"` SubParameters []*UIParameter `json:"subParameters,omitempty"` AdditionalParameter *UIParameter `json:"additionalParameter,omitempty"` Additional *bool `json:"additional,omitempty"` }
UIParameter Structured import table simple UI model
func ParseUIParameterFromDefinition ¶
func ParseUIParameterFromDefinition(definition []byte) ([]*UIParameter, error)
ParseUIParameterFromDefinition cue of parameter in Definitions was analyzed to obtain the form description model.
type Validate ¶
type Validate struct { Required bool `json:"required,omitempty"` Max *float64 `json:"max,omitempty"` MaxLength *uint64 `json:"maxLength,omitempty"` Min *float64 `json:"min,omitempty"` MinLength uint64 `json:"minLength,omitempty"` Pattern string `json:"pattern,omitempty"` Options []Option `json:"options,omitempty"` DefaultValue interface{} `json:"defaultValue,omitempty"` }
Validate parameter validate rule