wst

package
v1.8.7 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: MIT Imports: 18 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NilMap          = M{"<wst.NilMap>": 1}
	DashedCaseRegex = regexp.MustCompile("([A-Z])")
)
View Source
var NilBytes = []byte{'n', 'u', 'l', 'l'}
View Source
var RegexpIdEntire = regexp.MustCompile(`^([0-9a-f]{24})$`)
View Source
var RegexpIpStart = regexp.MustCompile(`^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}`)

Functions

func CreateDefaultMongoRegistry added in v1.7.2

func CreateDefaultMongoRegistry() *bsoncodec.Registry

func DashedCase

func DashedCase(st string) string

func GetTypedItem added in v1.8.0

func GetTypedItem[T any](m *M, path string) T

func GetTypedList added in v1.8.0

func GetTypedList[T any](m *M, path string) []T

func IsAnyDate added in v1.2.97

func IsAnyDate(data string) bool

func IsDate1 added in v1.2.97

func IsDate1(data string) bool

func IsDate2 added in v1.2.97

func IsDate2(data string) bool

func IsDate3 added in v1.2.97

func IsDate3(data string) (bool, []string)

func IsDate4 added in v1.2.97

func IsDate4(data string) bool

func LoadFile

func LoadFile(filePath string, out interface{}) error

func ParseDate added in v1.2.97

func ParseDate(data string) (time.Time, error)

func Transform added in v1.2.26

func Transform(in interface{}, out interface{}) error

Transform High-cost operation...

Types

type A added in v1.2.36

type A []M

func AFromGenericSlice added in v1.2.93

func AFromGenericSlice(in *[]interface{}) *A

AFromGenericSlice converts a generic slice of M to a *A This is used to convert the result of a query to a *A Returns nil if in is nil

func AFromPrimitiveSlice added in v1.2.93

func AFromPrimitiveSlice(in *primitive.A) *A

AFromPrimitiveSlice converts a primitive slice of primitive.M or M to a *A This is used to convert the result of a query to a *A Returns nil if in is nil

func (*A) GetAt added in v1.8.0

func (a *A) GetAt(idx int) *M

func (*A) GetM added in v1.8.0

func (a *A) GetM(path string) *M

func (*A) GetString added in v1.8.0

func (a *A) GetString(path string) string

func (*A) UnmarshalEasyJSON added in v1.7.2

func (a *A) UnmarshalEasyJSON(l *jlexer.Lexer)

type AggregationStage added in v1.6.5

type AggregationStage M

type BsonOptions added in v1.5.47

type BsonOptions struct {
	Registry *bsoncodec.Registry
}

type Fields added in v1.8.3

type Fields []string

type Filter added in v1.2.37

type Filter struct {
	Where       *Where             `json:"where"`
	Include     *Include           `json:"include"`
	Order       *Order             `json:"order"`
	Fields      *Fields            `json:"fields"`
	Skip        int64              `json:"skip"`
	Limit       int64              `json:"limit"`
	Aggregation []AggregationStage `json:"aggregation"`
}

type IApp

type IApp struct {
	Debug          bool
	SwaggerHelper  func() SwaggerHelper
	FindModel      func(modelName string) (interface{}, error)
	FindDatasource func(datasource string) (interface{}, error)
	Logger         func() ILogger
	JwtSecretKey   []byte
	Viper          *viper.Viper
	Bson           BsonOptions
}

type ILogger added in v1.7.2

type ILogger interface {
	Printf(format string, v ...any)
	Print(v ...any)
	Println(v ...any)
	Fatal(v ...any)
	Fatalf(format string, v ...any)
	Fatalln(v ...any)
	Panic(v ...any)
	Panicf(format string, v ...any)
	Panicln(v ...any)
	Flags() int
	SetFlags(flag int)
	Prefix() string
	SetPrefix(prefix string)
}

type Include added in v1.2.37

type Include []IncludeItem

type IncludeItem added in v1.2.73

type IncludeItem struct {
	Relation string  `json:"relation"`
	Scope    *Filter `json:"scope"`
}

type M added in v1.2.36

type M map[string]interface{}

func CopyMap

func CopyMap(src M) M

func (*M) GetBoolean added in v1.8.0

func (m *M) GetBoolean(path string) bool

func (*M) GetInt added in v1.7.2

func (m *M) GetInt(path string) int

func (*M) GetM added in v1.2.76

func (m *M) GetM(key string) *M

func (*M) GetString added in v1.2.76

func (m *M) GetString(path string) string

func (*M) MarshalEasyJSON added in v1.5.47

func (m *M) MarshalEasyJSON(w *jwriter.Writer)

func (*M) UnmarshalEasyJSON added in v1.6.0

func (m *M) UnmarshalEasyJSON(l *jlexer.Lexer)

type OperationName added in v1.5.40

type OperationName string
const (
	OperationNameFindById         OperationName = "findById"
	OperationNameFindMany         OperationName = "findMany"
	OperationNameCount            OperationName = "count"
	OperationNameCreate           OperationName = "create"
	OperationNameUpdateAttributes OperationName = "updateAttributes"
	OperationNameUpdateById       OperationName = "updateById"
	OperationNameUpdateMany       OperationName = "updateMany"
	OperationNameDeleteById       OperationName = "deleteById"
	OperationNameDeleteMany       OperationName = "deleteMany"
)

type Order added in v1.2.37

type Order []string

type Stats added in v1.5.29

type Stats struct {
	BuildsByModel map[string]map[string]float64
}

type SwaggerHelper added in v1.8.0

type SwaggerHelper interface {
	// GetOpenAPI returns the OpenAPI specification as a map, or an error if it fails
	GetOpenAPI() (M, error)
	// CreateOpenAPI creates a new OpenAPI specification and saves it to disk, or returns an error if it fails
	CreateOpenAPI() error
	// AddPathSpec adds a path specification to the OpenAPI specification
	AddPathSpec(path string, verb string, verbSpec M)
	// Dump dumps the OpenAPI specification to disk, or returns an error if it fails
	Dump() error
}

type WeStackError added in v1.4.1

type WeStackError struct {
	FiberError *fiber.Error
	Code       string
	Details    fiber.Map
	Name       string
	// contains filtered or unexported fields
}

func CreateError added in v1.4.1

func CreateError(fiberError *fiber.Error, code string, details fiber.Map, name string) *WeStackError

func (*WeStackError) Error added in v1.4.1

func (err *WeStackError) Error() string

type Where added in v1.2.37

type Where M

Jump to

Keyboard shortcuts

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