Documentation
¶
Index ¶
- Constants
- type Schema
- func (s *Schema) CreateRealtimeTriggers(db *pg.DB, functionName string) error
- func (s *Schema) CreateTable(db *pg.DB) error
- func (s *Schema) Fields() []SchemaField
- func (s *Schema) IsJsonapiModelCollection(data interface{}) bool
- func (s *Schema) IsPGModelCollection(data interface{}) bool
- func (s *Schema) IsResourceModelCollection(data interface{}) bool
- func (s *Schema) JSONAPIName() string
- func (s *Schema) NewJsonapiModelInstance() interface{}
- func (s *Schema) NewPGModelCollection(entries ...interface{}) interface{}
- func (s *Schema) NewPGModelInstance() interface{}
- func (s *Schema) NewResourceModelCollection(entries ...interface{}) interface{}
- func (s *Schema) NewResourceModelInstance() interface{}
- func (s *Schema) ParseJsonapiModel(instance interface{}) *SchemaInstance
- func (s *Schema) ParseJsonapiModelCollection(instance interface{}) []*SchemaInstance
- func (s *Schema) ParsePGModel(instance interface{}) *SchemaInstance
- func (s *Schema) ParsePGModelCollection(instance interface{}) []*SchemaInstance
- func (s *Schema) ParseResourceModel(instance interface{}) *SchemaInstance
- func (s *Schema) ParseResourceModelCollection(instance interface{}) []*SchemaInstance
- func (s *Schema) Table() string
- func (s *Schema) UnmarshalJsonapiPayload(in io.Reader, resourceModelInstance interface{}, validate *validator.Validate) (interface{}, error)
- type SchemaField
- type SchemaInstance
- type SchemaRegistry
Constants ¶
View Source
const ( IdFieldColumn = "id" IdFieldJsonapiName = "id" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Schema ¶
type Schema struct {
// contains filtered or unexported fields
}
func (*Schema) CreateRealtimeTriggers ¶
func (*Schema) CreateTable ¶
CreateTable creates the database table for this Schema if it doesn't exist yet.
func (*Schema) Fields ¶
func (s *Schema) Fields() []SchemaField
func (*Schema) IsJsonapiModelCollection ¶
func (*Schema) IsPGModelCollection ¶
func (*Schema) IsResourceModelCollection ¶
func (*Schema) JSONAPIName ¶
func (*Schema) NewJsonapiModelInstance ¶
func (s *Schema) NewJsonapiModelInstance() interface{}
func (*Schema) NewPGModelCollection ¶
func (s *Schema) NewPGModelCollection(entries ...interface{}) interface{}
func (*Schema) NewPGModelInstance ¶
func (s *Schema) NewPGModelInstance() interface{}
func (*Schema) NewResourceModelCollection ¶
func (s *Schema) NewResourceModelCollection(entries ...interface{}) interface{}
func (*Schema) NewResourceModelInstance ¶
func (s *Schema) NewResourceModelInstance() interface{}
func (*Schema) ParseJsonapiModel ¶
func (s *Schema) ParseJsonapiModel(instance interface{}) *SchemaInstance
func (*Schema) ParseJsonapiModelCollection ¶
func (s *Schema) ParseJsonapiModelCollection(instance interface{}) []*SchemaInstance
func (*Schema) ParsePGModel ¶
func (s *Schema) ParsePGModel(instance interface{}) *SchemaInstance
func (*Schema) ParsePGModelCollection ¶
func (s *Schema) ParsePGModelCollection(instance interface{}) []*SchemaInstance
func (*Schema) ParseResourceModel ¶
func (s *Schema) ParseResourceModel(instance interface{}) *SchemaInstance
func (*Schema) ParseResourceModelCollection ¶
func (s *Schema) ParseResourceModelCollection(instance interface{}) []*SchemaInstance
type SchemaField ¶
type SchemaField interface { // JSONAPIName returns the field's JSON API member name JSONAPIName() string // PGSelectColumn returns the pg column to use // when selecting this field from the database PGSelectColumn() string // PGFilterColumn returns the pg column to use // when filtering by this field from the database PGFilterColumn() string // Writable returns whether API users may // change the value of this field. Writable() bool // Sortable returns whether API users may // sort by this field. Sortable() bool // Filterable returns whether API users may // filter by this field. Filterable() bool // contains filtered or unexported methods }
type SchemaInstance ¶
type SchemaInstance struct {
// contains filtered or unexported fields
}
A SchemaInstance is an instance of a Schema holding values for each of the Schema fields.
func (*SchemaInstance) GetRelationIds ¶
func (i *SchemaInstance) GetRelationIds() map[*Schema][]int64
GetRelationIds returns all direct (belongsTo) relations to other resource schemas.
func (*SchemaInstance) ToJsonapiModel ¶
func (i *SchemaInstance) ToJsonapiModel() interface{}
ToPGModel creates a new PG Model Instance from the fields of the schema instance.
func (*SchemaInstance) ToPGModel ¶
func (i *SchemaInstance) ToPGModel() interface{}
func (*SchemaInstance) ToResourceModel ¶
func (i *SchemaInstance) ToResourceModel() interface{}
ToResourceModel creates a new Resource Model Instance from the fields of the schema instance.
func (*SchemaInstance) Validate ¶
func (i *SchemaInstance) Validate(validate *validator.Validate) error
Validate validates a schema instance according to validator rules.
type SchemaRegistry ¶
func (SchemaRegistry) RegisterSchema ¶
func (r SchemaRegistry) RegisterSchema(modelType reflect.Type) (schema *Schema, err error)
Source Files
¶
Click to show internal directories.
Click to hide internal directories.