generate

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDBNotCreated = errors.New("temporary db has not been created yet")

Functions

func ORMCode

func ORMCode(ctx context.Context, generator *gen.Generator) (err error)

Types

type DNSRecordQueries added in v0.1.1

type DNSRecordQueries interface {
	// GetRecentlyDeleted
	//
	// SELECT * FROM @@table WHERE deleted_at IS NOT NULL AND deleted_at > @oldest ORDER BY deleted_at DESC
	GetRecentlyDeleted(oldest time.Time) ([]gen.T, error)

	// GetMostSpecificRecord
	//
	// SELECT r.id, r.name, r.zone FROM records r INNER JOIN zones z ON r.zone = z.fqdn WHERE (
	//	r.record_type = @recordType AND r.deleted_at IS NULL AND z.deleted_at IS NULL AND
	// 	(
	// 		(r.name = '@' AND r.zone = @request) OR (@request LIKE REPLACE(r.name, '*', '%') || '.' || r.zone)
	//	)
	// ) ORDER BY LENGTH(r.zone) DESC, r.name DESC LIMIT 1
	GetMostSpecificRecord(request string, recordType records.RecordType) (gen.T, error)

	// ResolveRequest
	//
	// SELECT r.* FROM records r INNER JOIN zones z ON r.zone = z.fqdn WHERE (
	// 	r.record_type = @recordType AND r.name = @name AND r.zone = @zone
	//  AND r.deleted_at IS NULL AND z.deleted_at IS NULL
	// )
	//
	ResolveRequest(name string, zone string, recordType records.RecordType) ([]gen.T, error)

	// GetZoneRecords
	//
	// SELECT r.* FROM records r INNER JOIN zones z ON r.zone = z.fqdn WHERE (
	//	r.zone = @zone AND r.deleted_at IS NULL AND z.deleted_at IS NULL
	// )
	GetZoneRecords(zone string) ([]gen.T, error)
}

type DNSZoneQueries added in v0.1.1

type DNSZoneQueries interface {
	// GetRecentlyDeleted
	//
	// SELECT * FROM @@table WHERE deleted_at IS NOT NULL AND deleted_at > @oldest ORDER BY deleted_at DESC
	GetRecentlyDeleted(oldest time.Time) ([]gen.T, error)
}

type TemporaryDB

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

func CreateTemporaryDB

func CreateTemporaryDB(ctx context.Context) (*TemporaryDB, error)

func (*TemporaryDB) Close

func (t *TemporaryDB) Close() error

func (*TemporaryDB) DB

func (t *TemporaryDB) DB() (*gorm.DB, error)

Jump to

Keyboard shortcuts

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