database

package
v0.0.0-...-4d64e5c Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2021 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UserStatusActive   = "active"
	UserStatusDisabled = "disabled"
	UserStatusPending  = "pending"
)
View Source
const (
	VerificationTypeSignup = "signup"
)

Variables

View Source
var (
	ErrDuplicateEntry = errors.New("duplicate entry")
	ErrNotFound       = errors.New("not found")
	ErrInvalid        = errors.New("invalid operation")
	ErrUnauthorized   = errors.New("authorization failed")
)

Functions

func CheckPasswordHash

func CheckPasswordHash(password, hash string) bool

func HashPassword

func HashPassword(password string) (string, error)

Types

type ACL

type ACL struct {
	Read   bool
	List   bool
	Edit   bool
	Insert bool
	Delete bool
}

type DataBase

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

func Connect

func Connect(connectionString string) (*DataBase, error)

func (*DataBase) AddLocation

func (db *DataBase) AddLocation(userId ObjectId, zoneName string, l NewLocation) (ObjectId, error)

func (*DataBase) AddRecordSet

func (db *DataBase) AddRecordSet(userId ObjectId, zoneName string, location string, r NewRecordSet) (ObjectId, error)

func (*DataBase) AddUser

func (db *DataBase) AddUser(u NewUser) (ObjectId, error)

func (*DataBase) AddVerification

func (db *DataBase) AddVerification(name string, verificationType string) (string, error)

func (*DataBase) AddZone

func (db *DataBase) AddZone(userId ObjectId, z NewZone, soa types.SOA_RRSet, ns types.NS_RRSet) (ObjectId, error)

func (*DataBase) Clear

func (db *DataBase) Clear(removeUsers bool) error

func (*DataBase) Close

func (db *DataBase) Close() error

func (*DataBase) DeleteLocation

func (db *DataBase) DeleteLocation(userId ObjectId, zoneName string, location string) (int64, error)

func (*DataBase) DeleteRecordSet

func (db *DataBase) DeleteRecordSet(userId ObjectId, zoneName string, location string, recordType string) (int64, error)

func (*DataBase) DeleteUser

func (db *DataBase) DeleteUser(name string) (int64, error)

func (*DataBase) DeleteZone

func (db *DataBase) DeleteZone(userId ObjectId, zoneName string) (int64, error)

func (*DataBase) GetLocation

func (db *DataBase) GetLocation(userId ObjectId, zoneName string, location string) (Location, error)

func (*DataBase) GetLocations

func (db *DataBase) GetLocations(userId ObjectId, zoneName string, start int, count int, q string) (List, error)

func (*DataBase) GetRecordSet

func (db *DataBase) GetRecordSet(userId ObjectId, zoneName string, location string, recordType string) (RecordSet, error)

func (*DataBase) GetRecordSets

func (db *DataBase) GetRecordSets(userId ObjectId, zoneName string, location string) (List, error)

func (*DataBase) GetUser

func (db *DataBase) GetUser(name string) (User, error)

func (*DataBase) GetZone

func (db *DataBase) GetZone(userId ObjectId, zoneName string) (Zone, error)

func (*DataBase) GetZones

func (db *DataBase) GetZones(userId ObjectId, start int, count int, q string) (List, error)

func (*DataBase) UpdateLocation

func (db *DataBase) UpdateLocation(userId ObjectId, zoneName string, location string, l LocationUpdate) (int64, error)

func (*DataBase) UpdateRecordSet

func (db *DataBase) UpdateRecordSet(userId ObjectId, zoneName string, location string, recordType string, r RecordSetUpdate) (int64, error)

func (*DataBase) UpdateZone

func (db *DataBase) UpdateZone(userId ObjectId, zoneName string, z ZoneUpdate) (int64, error)

func (*DataBase) Verify

func (db *DataBase) Verify(code string) error

type List

type List []ListItem

type ListItem

type ListItem struct {
	Id      string `json:"id"`
	Enabled bool   `json:"enabled"`
}

type Location

type Location struct {
	Id      ObjectId
	Name    string
	Enabled bool
}

type LocationUpdate

type LocationUpdate struct {
	Enabled bool
}

type NewLocation

type NewLocation struct {
	Name    string
	Enabled bool
}

type NewRecordSet

type NewRecordSet struct {
	Type    string
	Value   string
	Enabled bool
}

type NewUser

type NewUser struct {
	Email    string
	Password string
	Status   string
}

type NewZone

type NewZone struct {
	Name            string
	Enabled         bool
	Dnssec          bool
	CNameFlattening bool
}

type ObjectId

type ObjectId string
const EmptyObjectId ObjectId = ""

func NewObjectId

func NewObjectId() ObjectId

type RecordSet

type RecordSet struct {
	Id      ObjectId
	Type    string
	Value   string
	Enabled bool
}

type RecordSetUpdate

type RecordSetUpdate struct {
	Value   string
	Enabled bool
}

type User

type User struct {
	Id       ObjectId
	Email    string
	Password string
	Status   string
}

type Zone

type Zone struct {
	Id              ObjectId
	Name            string
	Enabled         bool
	Dnssec          bool
	CNameFlattening bool
}

type ZoneUpdate

type ZoneUpdate struct {
	Enabled         bool
	Dnssec          bool
	CNameFlattening bool
	SOA             string
}

Jump to

Keyboard shortcuts

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