26 lines
762 B
Go
26 lines
762 B
Go
package models
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/google/uuid"
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
type Record struct {
|
|
ID uuid.UUID `gorm:"type:uuid;primary_key;default:gen_random_uuid()" json:"id"`
|
|
Record string `gorm:"not null;uniqueIndex:idx_record_domain_id" json:"record"`
|
|
DomainID uuid.UUID `gorm:"not null;uniqueIndex:idx_record_domain_id" json:"domain_id"`
|
|
CreatedAt time.Time `gorm:"not null;default:now()" json:"created_at"`
|
|
UpdatedAt time.Time `gorm:"not null;default:now()" json:"updated_at"`
|
|
DeletedAt gorm.DeletedAt `gorm:"index" json:"deleted_at"`
|
|
|
|
Domain Domain `gorm:"foreignKey:DomainID" json:"-"`
|
|
|
|
Endpoints []Endpoint `gorm:"foreignKey:RecordID" json:"-"`
|
|
}
|
|
|
|
func (Record) TableName() string {
|
|
return "records"
|
|
}
|