pomme/internal/api/types.go

45 lines
737 B
Go

package api
import "gorm.io/gorm"
const (
keyPrincipalContextID key = iota
)
const (
Tmp path = iota
Perm
)
type key int
type path int
// ZoneRequest represents a Zone file request.
type ZoneRequest struct {
*Zone
User string `json:"user,omitempty" gorm:"foreignKey:username;references:User"`
}
// Zone struct represents a zonefile.
type Zone struct {
gorm.Model
FileName string `json:"name"`
RawFileName string `json:"rawname"`
Body string `json:"body,omitempty"`
}
type GenericResponse[T map[string]any] struct {
Response map[string]any `json:"response,omitempty"`
}
type genericResponseFields map[string]any
type ndr interface {
parse() error
save(where path) error
}
var _ ndr = (*ZoneRequest)(nil)