shared

package
v0.0.0-...-f4e732c Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ScopeNone = iota
)

Variables

This section is empty.

Functions

func Contains

func Contains[T comparable](slice []T, value T) bool

func ToSnakeCase

func ToSnakeCase(str string) string

convert variable name to snake_case style work for camelCase and PascalCase as input

Types

type AttributeInfo

type AttributeInfo struct {
	Scope AttributeScope
	// contains filtered or unexported fields
}

func (AttributeInfo) AppendPath

func (ai AttributeInfo) AppendPath(segment string) AttributeInfo

func (AttributeInfo) Empty

func (ai AttributeInfo) Empty() bool

func (AttributeInfo) ModelPath

func (ai AttributeInfo) ModelPath() string

func (AttributeInfo) QueryPath

func (ai AttributeInfo) QueryPath() string

func (AttributeInfo) String

func (ai AttributeInfo) String() string

func (AttributeInfo) WithModelPath

func (ai AttributeInfo) WithModelPath(path string) AttributeInfo

type AttributeScope

type AttributeScope int

unused for now,

type ChipiCallbackInterface

type ChipiCallbackInterface interface {
}

This object can implement FilterRoute/FilterField/EnumResolver/SchemaResolver

type ChipiCallbacks

type ChipiCallbacks struct {
	FilterRouteInterface
	FilterFieldInterface
	EnumResolverInterface
	SchemaResolverInterface
	// contains filtered or unexported fields
}

func (*ChipiCallbacks) EnumResolver

func (c *ChipiCallbacks) EnumResolver(t reflect.Type) (bool, Enum)

func (*ChipiCallbacks) ExtraComponentsAndPaths

func (c *ChipiCallbacks) ExtraComponentsAndPaths() (openapi3.Schemas, openapi3.Paths)

func (*ChipiCallbacks) FilterField

func (c *ChipiCallbacks) FilterField(ctx context.Context, fieldInfo AttributeInfo) (bool, error)

func (*ChipiCallbacks) FilterRoute

func (c *ChipiCallbacks) FilterRoute(ctx context.Context, method string, pattern string) (bool, error)

func (*ChipiCallbacks) SchemaResolver

func (c *ChipiCallbacks) SchemaResolver(fieldInfo AttributeInfo, castName string) (*openapi3.Schema, bool)

type Enum

type Enum = []EnumEntry

type EnumEntry

type EnumEntry struct {
	Title interface{}
	Value interface{}
}

type EnumResolverInterface

type EnumResolverInterface interface {
	EnumResolver(t reflect.Type) (bool, Enum)
}

type ExtraComponentsAndPathsInterface

type ExtraComponentsAndPathsInterface interface {
	ExtraComponentsAndPaths() (openapi3.Schemas, openapi3.Paths)
}

type FilterFieldInterface

type FilterFieldInterface interface {
	FilterField(ctx context.Context, fieldInfo AttributeInfo) (bool, error)
}

type FilterRouteInterface

type FilterRouteInterface interface {
	FilterRoute(ctx context.Context, method string, pattern string) (bool, error)
}

type SchemaResolverInterface

type SchemaResolverInterface interface {
	// CastName is the string after the `as:` in the field tag
	// e.g. `chipi:"as:uuid"` => CastName = "uuid"
	// The openapi3.Schema is the schema that will be used to define the CastName field
	// The boolean decide if we create a $ref in the openapi file
	SchemaResolver(fieldInfo AttributeInfo, castName string) (*openapi3.Schema, bool)
}

Jump to

Keyboard shortcuts

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