database

package
v0.0.0-...-1711327 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCannotConvertToTx = errors.New("cannot convert to tx")

Functions

This section is empty.

Types

type AddZoneRecordParams

type AddZoneRecordParams struct {
	Zone   int32  `json:"zone"`
	Name   string `json:"name"`
	Type   string `json:"type"`
	Locked bool   `json:"locked"`
	Value  string `json:"value"`
}

type DBTX

type DBTX interface {
	ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
	PrepareContext(context.Context, string) (*sql.Stmt, error)
	QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
	QueryRowContext(context.Context, string, ...interface{}) *sql.Row
}

type DeleteZoneRecordByIdParams

type DeleteZoneRecordByIdParams struct {
	Zone int32 `json:"zone"`
	ID   int32 `json:"id"`
}

type GetBestLocationResolvedRecordParams

type GetBestLocationResolvedRecordParams struct {
	Column1 float64 `json:"column_1"`
	Column2 float64 `json:"column_2"`
	Name    string  `json:"name"`
}

type GetBestLocationResolvedRecordRow

type GetBestLocationResolvedRecordRow struct {
	ID        int32   `json:"id"`
	Service   int32   `json:"service"`
	Type      string  `json:"type"`
	Value     string  `json:"value"`
	Latitude  string  `json:"latitude"`
	Longitude string  `json:"longitude"`
	LatDiff   float64 `json:"lat_diff"`
	LongDiff  float64 `json:"long_diff"`
	D1        float64 `json:"d1"`
	D2        float64 `json:"d2"`
	D3        float64 `json:"d3"`
	Distance  float64 `json:"distance"`
}

type GetZoneRecordByIdParams

type GetZoneRecordByIdParams struct {
	Zone int32 `json:"zone"`
	ID   int32 `json:"id"`
}

type LookupRecordsForTypeParams

type LookupRecordsForTypeParams struct {
	Type   string `json:"type"`
	Name   string `json:"name"`
	Name_2 string `json:"name_2"`
}

type LookupRecordsForTypeRow

type LookupRecordsForTypeRow struct {
	ID       int32        `json:"id"`
	Zone     int32        `json:"zone"`
	Name     string       `json:"name"`
	Type     string       `json:"type"`
	Locked   bool         `json:"locked"`
	Ttl      nulls.UInt32 `json:"ttl"`
	Value    string       `json:"value"`
	ZoneName string       `json:"zone_name"`
}

func (LookupRecordsForTypeRow) ConvertRecord

func (r LookupRecordsForTypeRow) ConvertRecord() (*models.Record, error)

func (LookupRecordsForTypeRow) IsLocationResolving

func (r LookupRecordsForTypeRow) IsLocationResolving() bool

type PutZoneRecordByIdParams

type PutZoneRecordByIdParams struct {
	Value string `json:"value"`
	Zone  int32  `json:"zone"`
	ID    int32  `json:"id"`
}

type Queries

type Queries struct {
	// contains filtered or unexported fields
}

func New

func New(db DBTX) *Queries

func (*Queries) AddZone

func (q *Queries) AddZone(ctx context.Context, name string) (int64, error)

func (*Queries) AddZoneRecord

func (q *Queries) AddZoneRecord(ctx context.Context, arg AddZoneRecordParams) (int64, error)

func (*Queries) DeleteZoneRecordById

func (q *Queries) DeleteZoneRecordById(ctx context.Context, arg DeleteZoneRecordByIdParams) error

func (*Queries) GetAllServiceRecords

func (q *Queries) GetAllServiceRecords(ctx context.Context) ([]ServiceRecord, error)

func (*Queries) GetAllServices

func (q *Queries) GetAllServices(ctx context.Context) ([]Service, error)

func (*Queries) GetOwnedZones

func (q *Queries) GetOwnedZones(ctx context.Context, name []string) ([]Zone, error)

func (*Queries) GetZone

func (q *Queries) GetZone(ctx context.Context, name string) (Zone, error)

func (*Queries) GetZoneRecordById

func (q *Queries) GetZoneRecordById(ctx context.Context, arg GetZoneRecordByIdParams) (Record, error)

func (*Queries) GetZoneRecords

func (q *Queries) GetZoneRecords(ctx context.Context, name string) ([]Record, error)

func (*Queries) GetZones

func (q *Queries) GetZones(ctx context.Context) ([]Zone, error)

func (*Queries) LookupRecordsForType

func (q *Queries) LookupRecordsForType(ctx context.Context, arg LookupRecordsForTypeParams) ([]LookupRecordsForTypeRow, error)

func (*Queries) PutZoneRecordById

func (q *Queries) PutZoneRecordById(ctx context.Context, arg PutZoneRecordByIdParams) error

func (*Queries) Tx

func (q *Queries) Tx(ctx context.Context, opts *sql.TxOptions, fn func(db *Queries) error) error

func (*Queries) WithTx

func (q *Queries) WithTx(tx *sql.Tx) *Queries

type Record

type Record struct {
	ID     int32        `json:"id"`
	Zone   int32        `json:"zone"`
	Name   string       `json:"name"`
	Type   string       `json:"type"`
	Locked bool         `json:"locked"`
	Ttl    nulls.UInt32 `json:"ttl"`
	Value  string       `json:"value"`
}

func (Record) ConvertRecord

func (r Record) ConvertRecord(zone string) (*models.Record, error)

func (Record) IsLocationResolving

func (r Record) IsLocationResolving() bool

type Service

type Service struct {
	ID        int32  `json:"id"`
	Name      string `json:"name"`
	Available bool   `json:"available"`
}

type ServiceRecord

type ServiceRecord struct {
	ID        int32  `json:"id"`
	Service   int32  `json:"service"`
	Type      string `json:"type"`
	Value     string `json:"value"`
	Latitude  string `json:"latitude"`
	Longitude string `json:"longitude"`
}

type Zone

type Zone struct {
	ID   int32  `json:"id"`
	Name string `json:"name"`
}

Jump to

Keyboard shortcuts

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