database

package
v0.0.0-...-e7c744b Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Connect

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

func GetDSN

func GetDSN(c Config) (string, error)

GetDSN returns a DSN string from a config.

func IsRecordNotFoundError

func IsRecordNotFoundError(err error) bool

IsRecordNotFoundError returns true if the error was triggered by a record not being found.

Types

type Config

type Config struct {
	Dialect  string
	Host     string
	Port     int
	User     string
	Password string
	Name     string
	TLS      string

	Role string

	Params map[string]string

	QueryLog bool
}

Config holds information necessary for connecting to a database.

func (Config) Validate

func (c Config) Validate() error

Validate checks that the configuration is valid.

Jump to

Keyboard shortcuts

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