mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2026-05-10 02:25:21 +08:00
实现在域名解析中使用EdgeDNS
This commit is contained in:
@@ -184,3 +184,13 @@ func (this *NSDomainDAO) ListDomainsAfterVersion(tx *dbs.Tx, version int64, size
|
||||
FindAll()
|
||||
return
|
||||
}
|
||||
|
||||
// FindDomainIdWithName 根据名称查找域名
|
||||
func (this *NSDomainDAO) FindDomainIdWithName(tx *dbs.Tx, clusterId int64, name string) (int64, error) {
|
||||
return this.Query(tx).
|
||||
Attr("clusterId", clusterId).
|
||||
Attr("name", name).
|
||||
State(NSDomainStateEnabled).
|
||||
ResultPk().
|
||||
FindInt64Col(0)
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@ func (this *NSRecordDAO) CountAllEnabledRecords(tx *dbs.Tx, domainId int64, dnsT
|
||||
return query.Count()
|
||||
}
|
||||
|
||||
func (this *NSRecordDAO) ListAllEnabledRecords(tx *dbs.Tx, domainId int64, dnsType dnsconfigs.RecordType, keyword string, routeId int64, offset int64, size int64) (result []*NSRecord, err error) {
|
||||
func (this *NSRecordDAO) ListEnabledRecords(tx *dbs.Tx, domainId int64, dnsType dnsconfigs.RecordType, keyword string, routeId int64, offset int64, size int64) (result []*NSRecord, err error) {
|
||||
query := this.Query(tx).
|
||||
Attr("domainId", domainId).
|
||||
State(NSRecordStateEnabled)
|
||||
@@ -204,3 +204,17 @@ func (this *NSRecordDAO) ListRecordsAfterVersion(tx *dbs.Tx, version int64, size
|
||||
FindAll()
|
||||
return
|
||||
}
|
||||
|
||||
// FindEnabledRecordWithName 查询单条记录
|
||||
func (this *NSRecordDAO) FindEnabledRecordWithName(tx *dbs.Tx, domainId int64, recordName string, recordType dnsconfigs.RecordType) (*NSRecord, error) {
|
||||
record, err := this.Query(tx).
|
||||
State(NSRecordStateEnabled).
|
||||
Attr("domainId", domainId).
|
||||
Attr("name", recordName).
|
||||
Attr("type", recordType).
|
||||
Find()
|
||||
if record == nil {
|
||||
return nil, err
|
||||
}
|
||||
return record.(*NSRecord), nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user