meta

package
v0.0.0-...-e4d621a Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Field

type Field struct {
	GoName string
	DBName string
	Index  []int
	Type   reflect.Type

	Const     bool
	Required  bool
	Producers ProducerSet
}

Field describes a leaf structure field (not an embedded substructure). All fields are read-only.

func (Field) String

func (f Field) String() string

String returns the Go and DB field names

type Meta

type Meta struct{}

Meta is a type for dummy fields bearing tags for the containing structure

type Producer

type Producer string

Producer is a generic service name

type ProducerSet

type ProducerSet map[Producer]bool

ProducerSet is a set of allowed Producer values

func ParseProducerSet

func ParseProducerSet(pattern string) ProducerSet

ParseProducerSet parses a string into a ProducerSet. The string is a list of alternatives separated by "|". Other characters are matched exactly.

func (ProducerSet) String

func (ps ProducerSet) String() string

String implements fmt.Stringer

type Struct

type Struct struct {
	DBName string
	Type   reflect.Type
	Fields []Field
	// contains filtered or unexported fields
}

Struct describes a structure. All fields are read-only.

func Survey

func Survey(t reflect.Type) Struct

Survey produces a Struct describing a type

func SurveyNew

func SurveyNew(t reflect.Type) Struct

SurveyNew produces a Struct describing a type, ignoring all sections with upgrade=new

func SurveyOld

func SurveyOld(t reflect.Type) Struct

SurveyOld produces a Struct describing a type, ignoring all sections with upgrade=old

func (Struct) Field

func (s Struct) Field(name string) (Field, bool)

Field finds the field with a given Go name (if exists and is unique)

func (Struct) Identity

func (s Struct) Identity() Field

Identity returns the structure's identity field

func (Struct) String

func (s Struct) String() string

String returns the Go and DB type names

func (Struct) ValidateRequired

func (s Struct) ValidateRequired(entity any) error

ValidateRequired checks if all required fields of the entity are filled and returns an error if not

Jump to

Keyboard shortcuts

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