database

package
v0.0.0-...-fe53abc Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnectionConfig

type ConnectionConfig struct {
	DefaultConnectionName string
	Connections           []ConnectionDetail
}

ConnectionConfig berisi konfigurasi konesi database

type ConnectionDetail

type ConnectionDetail struct {
	ConnectionName string
	Driver         DBDriver
	Username       string
	Host           string
	Port           string
	DBName         string
	Passwrod       string
}

ConnectionDetail adalah konfigurasi struct untuk membangun suatu koneksi database

type Connections

type Connections struct {
	DefaultConnectionName string
	// contains filtered or unexported fields
}

Connections merupakan objek berisi kumpulan koneksi yang di buat menggunakan factory function BuildConnections

func BuildConnections

func BuildConnections(cc *ConnectionConfig) (*Connections, error)

BuildConnections merupakan factory function untuk struct Connection

func (*Connections) GetConnection

func (c *Connections) GetConnection(name string) (*DBConnection, error)

Get mengembalikan connectionData sesuai dengan yang diminta

func (*Connections) GetConnectionDefault

func (c *Connections) GetConnectionDefault() (*DBConnection, error)

Default mengembalikan DBConnection default

type DBConnection

type DBConnection struct {
	Driver       DBDriver
	DBName       string
	Conn         *sqlx.DB
	QueryBuilder squirrel.StatementBuilderType
}

DBConnection berisi data untuk melakuakan konesi database

type DBDriver

type DBDriver int8

DBDriver adalah enum untuk driver yang dapat dipilih pada saat membuat koneksi database baru

const (
	Undefined DBDriver = iota
	Postgres
)

func (DBDriver) Detail

func (d DBDriver) Detail(username string, password string, host string, port string, dbName string) *driverDetail

func (DBDriver) String

func (d DBDriver) String() string

Jump to

Keyboard shortcuts

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