db

package
v0.0.0-...-e4ff09b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 30, 2014 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

* Copyright (c) 2014 Hewlett-Packard Development Company, L.P. * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Copyright (c) 2014 Hewlett-Packard Development Company, L.P. * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Copyright (c) 2014 Hewlett-Packard Development Company, L.P. * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

Index

Constants

This section is empty.

Variables

View Source
var Database *sqlx.DB

Functions

func CheckDB

func CheckDB(dsn string) bool

Check that the Database is valid.

func Setup

func Setup(cfg *config.Configuration) (err error)

Connect and return a connection

Types

type ByPriority

type ByPriority struct{ Records }

func (ByPriority) Less

func (s ByPriority) Less(i, j int) bool

type Record

type Record struct {
	Id          string
	DomainId    string `db:"domain_id"`
	RecordSetId string `db:"recordset_id"`
	Data        string
	Priority    sql.NullInt64
	Hash        string
}

func GetRRSetRecords

func GetRRSetRecords(rrSet RecordSet) (records []*Record, err error)

func (Record) ExtractSOA

func (s Record) ExtractSOA() Soa

func (Record) ExtractSrv

func (s Record) ExtractSrv() Srv

Extract weight, port and dname from a srv string.

type RecordSet

type RecordSet struct {
	Id       string
	DomainId string `db:"domain_id"`
	Name     string
	Type     string
	Ttl      sql.NullInt64
	Records  Records
}

func GetRecordSet

func GetRecordSet(rrName string, rrType string) (rrSet RecordSet, err error)

func GetZoneRecordSets

func GetZoneRecordSets(zone Zone, rrType string, notType string) (rrSets []RecordSet, err error)

type Records

type Records []*Record

Records interface and helpers

func (Records) Len

func (s Records) Len() int

func (Records) Swap

func (s Records) Swap(i, j int)

type Soa

type Soa struct {
	Ns      string
	Mbox    string
	Serial  uint32
	Refresh uint32
	Retry   uint32
	Expire  uint32
	Minttl  uint32
}

type Srv

type Srv struct {
	Weight uint16
	Port   uint16
	Target string
}

type Zone

type Zone struct {
	Id      string `db:"id"`
	Version int
	Name    string
	Email   string
	Ttl     uint32
	Serial  int
	Refresh int
	Retry   int
	Expire  int
	Minimum int
}

Designate Zone

func GetZoneById

func GetZoneById(zoneId string) (z Zone, err error)

func GetZoneByName

func GetZoneByName(zoneName string) (z Zone, err error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL