Documentation
¶
Index ¶
- type Action
- type Field
- type FieldMapperFactory
- type Mapper
- type MapperFactory
- type Mappers
- type Schema
- type Schemas
- func (s *Schemas) AddFieldMapper(name string, factory FieldMapperFactory) *Schemas
- func (s *Schemas) AddMapper(schemaID string, mapper Mapper) *Schemas
- func (s *Schemas) AddMapperForType(obj interface{}, mapper ...Mapper) *Schemas
- func (s *Schemas) AddSchema(schema Schema) error
- func (s *Schemas) AddSchemas(schema *Schemas) (*Schemas, error)
- func (s *Schemas) Import(obj interface{}, externalOverrides ...interface{}) (*Schema, error)
- func (s *Schemas) Init(initFunc SchemasInitFunc) *Schemas
- func (s *Schemas) MustAddSchema(schema Schema) *Schemas
- func (s *Schemas) MustAddSchemas(schema *Schemas) *Schemas
- func (s *Schemas) MustCustomizeType(obj interface{}, f func(*Schema)) *Schemas
- func (s *Schemas) MustImport(obj interface{}, externalOverrides ...interface{}) *Schemas
- func (s *Schemas) MustImportAndCustomize(obj interface{}, f func(*Schema), externalOverrides ...interface{}) *Schemas
- func (s *Schemas) RemoveSchema(schema Schema) *Schemas
- func (s *Schemas) Schema(name string) *Schema
- func (s *Schemas) SchemaFor(t reflect.Type) *Schema
- func (s *Schemas) Schemas() []*Schema
- func (s *Schemas) SchemasByID() map[string]*Schema
- func (s *Schemas) TypeName(name string, obj interface{}) *Schemas
- type SchemasInitFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Field ¶
type Field struct {
Type string `json:"type,omitempty"`
Default interface{} `json:"default,omitempty"`
Nullable bool `json:"nullable,omitempty"`
Create bool `json:"create"`
WriteOnly bool `json:"writeOnly,omitempty"`
Required bool `json:"required,omitempty"`
Update bool `json:"update"`
MinLength *int64 `json:"minLength,omitempty"`
MaxLength *int64 `json:"maxLength,omitempty"`
Min *int64 `json:"min,omitempty"`
Max *int64 `json:"max,omitempty"`
Options []string `json:"options,omitempty"`
ValidChars string `json:"validChars,omitempty"`
InvalidChars string `json:"invalidChars,omitempty"`
Description string `json:"description,omitempty"`
CodeName string `json:"-"`
}
type FieldMapperFactory ¶
type MapperFactory ¶
type MapperFactory func() Mapper
type Schema ¶
type Schema struct {
ID string `json:"-"`
Description string `json:"description,omitempty"`
CodeName string `json:"-"`
CodeNamePlural string `json:"-"`
PkgName string `json:"-"`
PluralName string `json:"pluralName,omitempty"`
ResourceMethods []string `json:"resourceMethods,omitempty"`
ResourceFields map[string]Field `json:"resourceFields"`
ResourceActions map[string]Action `json:"resourceActions,omitempty"`
CollectionMethods []string `json:"collectionMethods,omitempty"`
CollectionFields map[string]Field `json:"collectionFields,omitempty"`
CollectionActions map[string]Action `json:"collectionActions,omitempty"`
Attributes map[string]interface{} `json:"attributes,omitempty"`
InternalSchema *Schema `json:"-"`
Mapper Mapper `json:"-"`
}
type Schemas ¶
type Schemas struct {
sync.Mutex
DefaultMapper MapperFactory
DefaultPostMapper MapperFactory
// contains filtered or unexported fields
}
func EmptySchemas ¶
func EmptySchemas() *Schemas
func NewSchemas ¶
func (*Schemas) AddFieldMapper ¶
func (s *Schemas) AddFieldMapper(name string, factory FieldMapperFactory) *Schemas
func (*Schemas) AddMapperForType ¶
func (*Schemas) Init ¶
func (s *Schemas) Init(initFunc SchemasInitFunc) *Schemas
func (*Schemas) MustAddSchema ¶
func (*Schemas) MustAddSchemas ¶
func (*Schemas) MustCustomizeType ¶
func (*Schemas) MustImport ¶
func (*Schemas) MustImportAndCustomize ¶
func (*Schemas) RemoveSchema ¶
func (*Schemas) SchemasByID ¶
type SchemasInitFunc ¶
Click to show internal directories.
Click to hide internal directories.