Documentation
¶
Index ¶
- type Backend
- func (b *Backend) AddZone(db *gorm.DB, zone *Zone) (err error)
- func (b *Backend) BeforeCreate(tx *gorm.DB) (err error)
- func (b *Backend) Delete(db *gorm.DB) (err error)
- func (b *Backend) Get(db *gorm.DB, preload bool) (err error)
- func (b *Backend) Link() *jsonapi.Link
- func (b *Backend) LinkRelation(relation string) *jsonapi.Link
- func (b *Backend) RemoveZone(db *gorm.DB, zone *Zone) (err error)
- func (b *Backend) ReplaceZones(db *gorm.DB, zones []*Zone) (err error)
- func (b *Backend) Update(db *gorm.DB, backend Backend) (err error)
- type Record
- func (r *Record) BeforeCreate(tx *gorm.DB) (err error)
- func (r *Record) Delete(db *gorm.DB) error
- func (r *Record) DeleteZone(db *gorm.DB) error
- func (r *Record) Get(db *gorm.DB, preload bool) error
- func (r *Record) Link() *jsonapi.Link
- func (r *Record) LinkRelation(relation string) *jsonapi.Link
- func (r *Record) ReplaceZone(db *gorm.DB, zone *Zone) error
- func (r *Record) Update(db *gorm.DB, record Record) error
- type Zone
- func (z *Zone) AddBackend(db *gorm.DB, backend *Backend) (err error)
- func (z *Zone) AddRecord(db *gorm.DB, record *Record) (err error)
- func (z *Zone) BeforeCreate(tx *gorm.DB) (err error)
- func (z *Zone) Delete(db *gorm.DB) (err error)
- func (z *Zone) Get(db *gorm.DB, preload bool) (err error)
- func (z *Zone) Link() *jsonapi.Link
- func (z *Zone) LinkRelation(relation string) *jsonapi.Link
- func (z *Zone) RemoveBackend(db *gorm.DB, backend *Backend) (err error)
- func (z *Zone) RemoveRecord(db *gorm.DB, record *Record) (err error)
- func (z *Zone) ReplaceBackends(db *gorm.DB, backends []*Backend) (err error)
- func (z *Zone) ReplaceRecords(db *gorm.DB, records []*Record) (err error)
- func (z *Zone) Update(db *gorm.DB, zone Zone) (err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend struct {
ID string `gorm:"primarykey'not null" jsonapi:"primary,backends" json:"id,omitempty"`
CreatedAt time.Time `jsonapi:"attribute" json:"created_at,omitempty"`
UpdatedAt time.Time `jsonapi:"attribute" json:"updated_at,omitempty"`
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
Name string `gorm:"uniqueIndex;not null" jsonapi:"attribute" json:"name"`
Zones []*Zone `gorm:"many2many:backend_zones;" jsonapi:"relationship" json:"zones,omitempty"`
}
func (*Backend) BeforeCreate ¶
BeforeCreate generates a new ULID for the backend if needed
func (*Backend) LinkRelation ¶
LinkRelation returns the link to the relationship
func (*Backend) RemoveZone ¶
RemoveZone removes a zone from the backend
func (*Backend) ReplaceZones ¶
ReplaceZones replaces the zones of the backend
type Record ¶
type Record struct {
ID string `gorm:"primarykey;not null" jsonapi:"primary,records"`
CreatedAt time.Time `jsonapi:"attribute" json:"created_at,omitempty"`
UpdatedAt time.Time `jsonapi:"attribute" json:"updated_at,omitempty"`
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
Name string `gorm:"uniqueIndex;not null" jsonapi:"attribute" json:"name"`
TTL int `gorm:"not null;default:3600" jsonapi:"attribute" json:"ttl"`
Type string `gorm:"not null" jsonapi:"attribute" json:"type"`
Content string `gorm:"not null" jsonapi:"attribute" json:"content"`
Zone *Zone `gorm:"-" jsonapi:"relationship" json:"zones"`
ZoneID string `gorm:"foreignKey:ZoneID" json:"-"`
}
func (*Record) BeforeCreate ¶
BeforeCreate generates a new ULID for the record if needed TOOO: Implement data validation for the record type and content
func (*Record) DeleteZone ¶
DeleteZone deletes the zone of the record
func (*Record) LinkRelation ¶
LinkRelation returns the link to the related resource
func (*Record) ReplaceZone ¶
ReplaceZone replaces the zone of the record
type Zone ¶
type Zone struct {
ID string `gorm:"primarykey,not null" jsonapi:"primary,zones"`
CreatedAt time.Time `jsonapi:"attribute" json:"created_at,omitempty"`
UpdatedAt time.Time `jsonapi:"attribute" json:"updated_at,omitempty"`
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
Name string `gorm:"uniqueIndex;not null" jsonapi:"attribute" json:"name"`
TTL int `gorm:"default:3600" jsonapi:"attribute" json:"ttl"`
MName string `gorm:"default:@;not null" jsonapi:"attribute" json:"mname"`
RName string `gorm:"default:admin;not null" jsonapi:"attribute" json:"rname"`
Serial int `gorm:"default:1" jsonapi:"attribute" json:"serial"`
Refresh int `gorm:"default:3600" jsonapi:"attribute" json:"refresh"`
Retry int `gorm:"default:600" jsonapi:"attribute" json:"retry"`
Expire int `gorm:"default:604800" jsonapi:"attribute" json:"expire"`
Minimum int `gorm:"default:3600" jsonapi:"attribute" json:"minimum"`
Records []*Record `gorm:"foreignKey:ZoneID" jsonapi:"relationship" json:"records,omitempty"`
Backends []*Backend `gorm:"many2many:backend_zones;" jsonapi:"relationship" json:"backends,omitempty"`
}
func (*Zone) AddBackend ¶
AddBackend adds a zone to the zone
func (*Zone) BeforeCreate ¶
BeforeCreate generates a new ULID for the zone if needed
func (*Zone) LinkRelation ¶
LinkRelation returns the link to the related resource
func (*Zone) RemoveBackend ¶
RemoveBackend removes a backend from the zone
func (*Zone) RemoveRecord ¶
RemoveRecord removes a record from the zone
func (*Zone) ReplaceBackends ¶
ReplaceBackends replaces all backends of the zone
func (*Zone) ReplaceRecords ¶
ReplaceRecords replaces all records of the zone