db

package
v0.0.0-...-e970dd6 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataSource

type DataSource interface {
	InitDB() (*bun.DB, error)
}

DataSource provide the method(s) to set up the database and its tables

func NewDB

func NewDB() (DataSource, error)

NewDB gets builds the right datasource based on the type

type MariadbDataSource

type MariadbDataSource struct {
	User     string
	Password string
	Host     string
	Port     string
	Database string
}

MariadbDataSource holds the information used to build the mysql or mariadb datasource

func (MariadbDataSource) InitDB

func (m MariadbDataSource) InitDB() (*bun.DB, error)

InitDB creates the initial connection to the database and create the application tables implements DataSource

type PostgresqlDataSource

type PostgresqlDataSource struct {
	User     string
	Password string
	Host     string
	Port     string
	Database string
	SSLMode  string
}

PostgresqlDataSource holds the information used to build the psql datasource

func (PostgresqlDataSource) InitDB

func (p PostgresqlDataSource) InitDB() (*bun.DB, error)

InitDB creates the initial connection to the database and create the application tables implements DataSource

type SqlliteDataSource

type SqlliteDataSource struct {
	DbFilePath string
}

SqlliteDataSource holds the information used to build the sqllite datasource

func (SqlliteDataSource) InitDB

func (d SqlliteDataSource) InitDB() (*bun.DB, error)

InitDB creates the initial connection to the database and create the application tables implements DataSource

Jump to

Keyboard shortcuts

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