Documentation
¶
Index ¶
- Variables
- type Auth
- type Collection
- type CollectionField
- type CollectionMeta
- type CollectionResponse
- type CollectionSchema
- type Diff
- type Difference
- type Directus
- func (d *Directus) ApplyDiff(diff *Diff) error
- func (d *Directus) CreateCollection(c *Collection) error
- func (d *Directus) CreateField(field Field) error
- func (d Directus) GetAuth(email, password string) (*Auth, error)
- func (d *Directus) GetCollection(collection string) (*Collection, error)
- func (d *Directus) GetDiff(s *Snapshot, force bool) (*Diff, error)
- func (d *Directus) GetFieldOfCollection(collection string) (*Field, error)
- func (d *Directus) GetRawDiff(s *Snapshot, format string, force bool) ([]byte, error)
- func (d *Directus) GetRawSnapshot(format string) ([]byte, error)
- func (d *Directus) GetSnapshot() (*Snapshot, error)
- func (d *Directus) Login(email, password string) error
- func (d *Directus) SetToken(token string)
- func (d *Directus) TestConnection() error
- type Field
- type FieldMeta
- type FieldSchema
- type Meta
- type Schema
- type Snapshot
- type Translation
Constants ¶
This section is empty.
Variables ¶
View Source
var DiffErr400 = fmt.Errorf("Failed with status code 400. Maybe the Directus versions does'nt match.")
Functions ¶
This section is empty.
Types ¶
type Collection ¶
type Collection struct {
Collection string `json:"collection"`
Meta CollectionMeta `json:"meta"`
Schema CollectionSchema `json:"schema"`
Fields []CollectionField `json:"fields,omitempty"`
}
func UnmarshalCollection ¶
func UnmarshalCollection(data []byte) (*Collection, error)
func (*Collection) Marshal ¶
func (r *Collection) Marshal() ([]byte, error)
type CollectionField ¶
type CollectionField struct {
Field string `json:"field"`
Type string `json:"type"`
Meta FieldMeta `json:"meta"`
Schema FieldSchema `json:"schema"`
}
type CollectionMeta ¶
type CollectionMeta struct {
Collection string `json:"collection"`
Icon *string `json:"icon"`
Note *string `json:"note"`
DisplayTemplate *string `json:"display_template"`
Hidden bool `json:"hidden"`
Singleton bool `json:"singleton"`
Translations []Translation `json:"translations"`
ArchiveField *string `json:"archive_field"`
ArchiveValue string `json:"archive_value"`
UnarchiveValue string `json:"unarchive_value"`
ArchiveAppFilter bool `json:"archive_app_filter"`
SortField *string `json:"sort_field"`
ItemDuplicationFields interface{} `json:"item_duplication_fields"`
Sort *int64 `json:"sort"`
Accountability *string `json:"accountability,omitempty"`
Color interface{} `json:"color"`
Group interface{} `json:"group"`
Collapse *string `json:"collapse,omitempty"`
PreviewURL interface{} `json:"preview_url"`
Versioning *bool `json:"versioning,omitempty"`
}
type CollectionResponse ¶
type CollectionResponse struct {
Data Collection `json:"data"`
}
type CollectionSchema ¶
type Diff ¶
type Diff struct {
Hash string `json:"hash"`
Diff Difference `json:"diff"`
}
type Difference ¶
type Difference struct {
Collections []map[string]*json.RawMessage `json:"collections"`
Fields []map[string]*json.RawMessage `json:"fields"`
Relations []map[string]*json.RawMessage `json:"relations"`
}
type Directus ¶
type Directus struct {
Url string
// contains filtered or unexported fields
}
func NewDirectus ¶
func (*Directus) CreateCollection ¶
func (d *Directus) CreateCollection(c *Collection) error
func (*Directus) CreateField ¶
func (*Directus) GetCollection ¶
func (d *Directus) GetCollection(collection string) (*Collection, error)
func (*Directus) GetFieldOfCollection ¶
func (*Directus) GetRawDiff ¶
func (*Directus) GetSnapshot ¶
func (*Directus) TestConnection ¶
type Field ¶
type Field struct {
Collection string `json:"collection"`
Field string `json:"field"`
Type string `json:"type"`
Meta Meta `json:"meta"`
Schema Schema `json:"schema"`
}
func UnmarshalField ¶
type FieldSchema ¶
type Meta ¶
type Meta struct {
ID int64 `json:"id"`
Collection string `json:"collection"`
Field string `json:"field"`
Special interface{} `json:"special"`
Interface string `json:"interface"`
Options interface{} `json:"options"`
Display interface{} `json:"display"`
DisplayOptions interface{} `json:"display_options"`
Readonly bool `json:"readonly"`
Hidden bool `json:"hidden"`
Sort int64 `json:"sort"`
Width string `json:"width"`
Translations interface{} `json:"translations"`
Note string `json:"note"`
}
type Schema ¶
type Schema struct {
Name string `json:"name"`
Table string `json:"table"`
DataType string `json:"data_type"`
DefaultValue interface{} `json:"default_value"`
MaxLength interface{} `json:"max_length"`
NumericPrecision int64 `json:"numeric_precision"`
NumericScale int64 `json:"numeric_scale"`
IsNullable bool `json:"is_nullable"`
IsPrimaryKey bool `json:"is_primary_key"`
HasAutoIncrement bool `json:"has_auto_increment"`
ForeignKeyColumn interface{} `json:"foreign_key_column"`
ForeignKeyTable interface{} `json:"foreign_key_table"`
Comment interface{} `json:"comment"`
}
type Snapshot ¶
type Snapshot struct {
Version *int `json:"version"`
Directus *string `json:"directus"`
Vendor *string `json:"vendor"`
Collections []map[string]*json.RawMessage `json:"collections"`
Fields []map[string]*json.RawMessage `json:"fields"`
Relations []map[string]*json.RawMessage `json:"relations"`
}
Click to show internal directories.
Click to hide internal directories.