data

package
v0.0.0-...-c953a64 Latest Latest
Warning

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

Go to latest
Published: May 29, 2020 License: MPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SaveConnectionInfo

func SaveConnectionInfo(key []byte, database string, connectionString string, appID string) error

SaveConnectionInfo Save the connection info to a file located in the CWD

Types

type Application

type Application struct {
	AppID           string     `gorm:"primary_key"`
	ApplicationName string     `gorm:"index;not null"`
	HashedSecret    string     `gorm:"not null"`
	DeletedAt       *time.Time `sql:"index"`
}

Application the key value pair

type ConfigValue

type ConfigValue struct {
	DomainID int64  `gorm:"primary_key;auto_increment:false"`
	Owner    Domain `gorm:"foreignkey:DomainID"`
	Key      string `gorm:"index:configKey;primary_key"`
	Value    string `gorm:"not null"`
}

ConfigValue the key value pair

type Domain

type Domain struct {
	DomainID  int64         `gorm:"AUTO_INCREMENT"`
	Owners    []Application `gorm:"many2many:application"`
	Name      string        `gorm:"unique_index"`
	DeletedAt *time.Time    `sql:"index"`
}

Domain the domain which holds the configuration values

type Store

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

Store contains the connection to the store holding the configuration data.

func CreateStore

func CreateStore(provider string, connection string) (store *Store, err error)

CreateStore create a store

func (Store) FindApplicationByID

func (s Store) FindApplicationByID(id string) (*Application, error)

func (Store) FindApplicationByName

func (s Store) FindApplicationByName(name string) (*Application, error)

func (Store) FindConfigValuesByDomain

func (s Store) FindConfigValuesByDomain(d *Domain) (cvs []ConfigValue, err error)

FindConfigValuesByDomain will do exactly what is says.

func (Store) FindDomainsByNameExact

func (s Store) FindDomainsByNameExact(domainName string) (domain []Domain, err error)

FindDomainsByNameExact - find all domains with a specific name, will return an error if one occurs.

func (Store) FindDomainsByNameLike

func (s Store) FindDomainsByNameLike(domainName string) (domain []Domain, err error)

FindDomainsByNameLike - find all domains with a specific name, will return an error if one occurs.

func (Store) StoreApplication

func (s Store) StoreApplication(app *Application) error

StoreApplication will put a given application into the store

func (Store) StoreConfigValue

func (s Store) StoreConfigValue(toStore *ConfigValue) error

StoreConfigValue store a new ConfigValue connected to the given domain.

func (Store) StoreDomain

func (s Store) StoreDomain(domain *Domain) error

StoreDomain Create a new domain in the store

Jump to

Keyboard shortcuts

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