fields

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StaticValue

func StaticValue[Model any](v any) func(oldField Field)

Types

type ConcreteField added in v1.1.0

type ConcreteField[Model any] struct {
	Readable bool
	Writable bool
	// contains filtered or unexported fields
}

func (*ConcreteField[Model]) IsReadable added in v1.1.0

func (s *ConcreteField[Model]) IsReadable() bool

func (*ConcreteField[Model]) IsWritable added in v1.1.0

func (s *ConcreteField[Model]) IsWritable() bool

func (*ConcreteField[Model]) Name added in v1.1.0

func (s *ConcreteField[Model]) Name() string

func (*ConcreteField[Model]) ToInternalValue added in v1.1.0

func (s *ConcreteField[Model]) ToInternalValue(reprModel map[string]any, ctx *gin.Context) (any, error)

func (*ConcreteField[Model]) ToRepresentation added in v1.1.0

func (s *ConcreteField[Model]) ToRepresentation(intVal models.InternalValue, ctx *gin.Context) (any, error)

func (*ConcreteField[Model]) WithInternalValueFunc added in v1.1.0

func (s *ConcreteField[Model]) WithInternalValueFunc(f InternalValueFunc) Field

func (*ConcreteField[Model]) WithReadOnly added in v1.1.0

func (s *ConcreteField[Model]) WithReadOnly() Field

func (*ConcreteField[Model]) WithReadWrite added in v1.1.0

func (s *ConcreteField[Model]) WithReadWrite() Field

func (*ConcreteField[Model]) WithRepresentationFunc added in v1.1.0

func (s *ConcreteField[Model]) WithRepresentationFunc(f RepresentationFunc) Field

func (*ConcreteField[Model]) WithWriteOnly added in v1.1.0

func (s *ConcreteField[Model]) WithWriteOnly() Field

type ErrorFieldIsNotPresentInPayload

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

func NewErrorFieldIsNotPresentInPayload

func NewErrorFieldIsNotPresentInPayload(name string) ErrorFieldIsNotPresentInPayload

func (ErrorFieldIsNotPresentInPayload) Error

type Field

type Field interface {
	Name() string
	ToRepresentation(models.InternalValue, *gin.Context) (any, error)
	ToInternalValue(map[string]any, *gin.Context) (any, error)

	IsReadable() bool
	IsWritable() bool

	WithReadOnly() Field
	WithWriteOnly() Field
	WithReadWrite() Field

	WithRepresentationFunc(RepresentationFunc) Field
	WithInternalValueFunc(InternalValueFunc) Field
}

func NewField

func NewField[Model any](name string) Field

type GRFParsable

type GRFParsable interface {
	FromRepresentation(any) error
}

type GRFRepresentable

type GRFRepresentable interface {
	ToRepresentation() (any, error)
}

type InternalValueFunc

type InternalValueFunc func(map[string]any, string, *gin.Context) (any, error)

type RepresentationFunc

type RepresentationFunc func(models.InternalValue, string, *gin.Context) (any, error)

Jump to

Keyboard shortcuts

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