Documentation
¶
Index ¶
Constants ¶
View Source
const CurrentVersion = "1.0"
View Source
const DefUserID int64 = 1
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Domain ¶
type IDatabase ¶
type IDatabase interface {
Init() error
Close() error
IDomains
FindByKey(key string) (*Recode, error)
ClearRecodes(bSynced bool) error
GetVersion() int64
SetVersion(v int64) //only slave sync
BeginTransaction() (IDatabase, error)
Rollback() error
Commit() error
RegListener(l OnDomainChanged)
UnRegListener(l OnDomainChanged)
}
type IDomains ¶
type IDomains interface {
NewDomain(userID int64, domain *Domain) (int64, error)
UpdateDomain(domainID int64, newName string) error
DeleteDomain(domainID int64) error
GetDomain(domainID int64) (*Domain, error)
FindDomainByName(domain string) (*Domain, error)
GetDomains(userID int64) ([]*Domain, error)
GetAllDomains(offset, limit int) ([]*Domain, error)
GetRecodes(domainID int64, offset, limit int) ([]*Recode, error)
NewRecode(domainID int64, r *Recode) (int64, error)
GetRecode(id int64) (*Recode, error)
DeleteRecode(id int64) error
UpdateRecode(id int64, r *Recode) error
FindByName(domainID int64, name string) (*Recode, error)
}
type OnDomainChanged ¶
type OnDomainChanged func()
type Recode ¶
type Recode struct {
Model
DomainID int64 `gorm:"unique_index:recode_unique;column:domain_id;index"`
Dynamic bool `gorm:"column:dynamic"` //是否未动态
UpdateKey sql.NullString `gorm:"column:key;unique_index"`
Synced bool `gorm:"column:synced;default:'false'"` //for slave
RecordType RecodeType `gorm:"unique_index:recode_unique;column:type;type:int"` // 1 ipv4
RecordHost string `gorm:"unique_index:recode_unique;column:host"`
RecodeValue string `gorm:"unique_index:recode_unique;column:value"`
TTL uint32 `gorm:"column:ttl"`
}
type SchemaVersion ¶
func (SchemaVersion) TableName ¶
func (SchemaVersion) TableName() string
Click to show internal directories.
Click to hide internal directories.