path

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NoFlags = Flags(0x00000000)

	FlagResponseHashed           = Flags(0x00000001)
	FlagRequestIsNotArray        = Flags(0x00000002)
	FlagRequestDontMakeFlatModel = Flags(0x00000004)
	FlagResponseIsNotArray       = Flags(0x00000008)

	// VarName
	VarIgnore = "_"
	VarID     = "ID"
	VarGUID   = "GUID"
	VarName   = "Name"
	VarStatus = "Status"

	// Имена тегов полей в описании query параметров
	TagJSON     = "json"
	TagDB       = "db"
	TagSample   = "sample"
	TagComment  = "comment"
	TagRequired = "required"
	TagRole     = "role"
	TagRef      = "ref"
	TagDefault  = "default"

	RolePrimary     = "primary"
	RoleKey         = "key"
	StdPrimaryField = VarID
)

Variables

This section is empty.

Functions

func GetKnownObjects

func GetKnownObjects() map[string]*Object

func SaveObject

func SaveObject(name string, obj reflect.Type, withArray bool) (err error)

func StructType

func StructType(v any) (t reflect.Type, err error)

Types

type Chain

type Chain struct {
	Parent      *Chains  `json:"-"`
	Description string   `json:"description"`
	Name        string   `json:"name"`
	Scope       string   `json:"scope,omitempty"`
	Tokens      []*Token `json:"tokens"`
}

func (*Chain) Clone

func (chain *Chain) Clone() *Chain

type Chains

type Chains struct {
	Flags       Flags      `json:"flags,omitempty"`
	Summary     string     `json:"summary"`
	Description string     `json:"description"`
	Chains      ChainsList `json:"chains"`

	PathParamsPattern any          `json:"pathParams"`
	PathParamsType    reflect.Type `json:"-"`

	QueryParamsPattern any          `json:"queryParams"`
	QueryParamsType    reflect.Type `json:"-"`

	RequestObjectName      string         `json:"requestObjectName"`
	RequestContentType     string         `json:"requestContentType,omitempty"` // Значение по умолчанию для Content-Type на входе. По умолчанию JSON
	RequestPattern         any            `json:"request"`
	RequestType            reflect.Type   `json:"-"`
	RequestFlatModel       misc.StringMap `json:"-"`                      // ключ - путь до поля, значение - его tag db
	RequestUniqueKeyFields []string       `json:"requestUniqueKeyFields"` // уникальные поля, первый - primary key (формально)

	ResponseObjectName  string       `json:"responseObjectName"`
	ResponseContentType string       `json:"responseContentType,omitempty"` // Значение по умолчанию для Content-Type на выходе. По умолчанию JSON
	ResponsePattern     any          `json:"response"`
	ResponseType        reflect.Type `json:"-"`
	SrcResponsePattern  any          `json:"-"`
	SrcResponseType     reflect.Type `json:"-"`

	DBFields []string `json:"-"`
	// contains filtered or unexported fields
}

func (*Chains) Clone

func (chains *Chains) Clone() *Chains

func (*Chains) ExtractFieldsFromBody

func (chains *Chains) ExtractFieldsFromBody(body []byte) (fields misc.InterfaceMap, notice error, err error)

func (*Chains) Find

func (chains *Chains) Find(path []string) (matched *Chain, pathParams any, code int, err error)

func (*Chains) Len

func (chains *Chains) Len() int

func (*Chains) Less

func (chains *Chains) Less(i, j int) bool

func (*Chains) Prepare

func (chains *Chains) Prepare() (err error)

func (*Chains) Swap

func (c *Chains) Swap(i, j int)

type ChainsList

type ChainsList []*Chain

func (ChainsList) Clone

func (chainsList ChainsList) Clone() ChainsList

type Flags

type Flags uint64

type Method

type Method = string

type Methods

type Methods map[Method]*Chains

type Object

type Object struct {
	Type      reflect.Type
	ArrayType reflect.Type
}

type Set

type Set struct {
	Flags       Flags   `json:"flags,omitempty"`
	Description string  `json:"description"`
	Methods     Methods `json:"methods"`
}

func (*Set) Clone

func (set *Set) Clone() *Set

func (*Set) Find

func (set *Set) Find(m Method, path []string) (matched *Chain, pathParams any, result any, code int, err error)

func (*Set) Prepare

func (set *Set) Prepare() (err error)

type Token

type Token struct {
	Description string `json:"description"`
	Expr        string `json:"expr"`
	VarName     string `json:"varName"`
	// contains filtered or unexported fields
}

func (*Token) Clone

func (token *Token) Clone() *Token

type Vars

type Vars misc.InterfaceMap

Jump to

Keyboard shortcuts

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