storage

package
v0.3.6-alpha2 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDBNotSupported = errors.New("not supported db")
View Source
var ErrIncompleteCertInformationProvided = errors.New("you provided some, but not all certificate information")

Functions

func GetGlobalDB

func GetGlobalDB() *gorm.DB

func LoadDB

func LoadDB(c Config) (*gorm.DB, error)

LoadDB serves as a singleton that initializes the value of db per package

func NewDB

func NewDB(c Config) (*gorm.DB, error)

NewDB creates an instance of database based on config

Types

type Config

type Config struct {
	Use       string `default:"cockroach"`
	Prefix    string `default:""`
	Cockroach struct {
		Host              string `default:"cockroach"`
		Port              string `default:"26257"`
		UserName          string `default:"root"`
		Password          string `default:""`
		ClientCA          string `default:""`
		ClientSSLKey      string `default:""`
		ClientSSLCert     string `default:""`
		Database          string `default:"scoretrak"`
		ConfigureZones    bool   `default:"true"`
		DefaultZoneConfig struct {
			GcTtlseconds                    uint64 `default:"600"`
			BackpressureRangeSizeMultiplier uint64 `default:"0"`
		}
	}
	Sqlite struct {
		Path     string `default:"scoretrak.db"`
		Database string `default:"scoretrak"`
	}
}

Directories

Path Synopsis
orm

Jump to

Keyboard shortcuts

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