fields

package
v0.0.0-...-a2ff9df Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2024 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[Model])

Types

type ErrorFieldIsNotPresentInPayload

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

func NewErrorFieldIsNotPresentInPayload

func NewErrorFieldIsNotPresentInPayload(name string) ErrorFieldIsNotPresentInPayload

func (ErrorFieldIsNotPresentInPayload) Error

type Field

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

func NewField

func NewField[Model any](name string) *Field[Model]

func (*Field[Model]) Name

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

func (*Field[Model]) ReadOnly

func (s *Field[Model]) ReadOnly() *Field[Model]

func (*Field[Model]) ReadWrite

func (s *Field[Model]) ReadWrite() *Field[Model]

func (*Field[Model]) ToInternalValue

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

func (*Field[Model]) ToRepresentation

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

func (*Field[Model]) WithInternalValueFunc

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

func (*Field[Model]) WithRepresentationFunc

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

func (*Field[Model]) WriteOnly

func (s *Field[Model]) WriteOnly() *Field[Model]

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