database

package
v0.0.0-...-54b0228 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2022 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NextID

func NextID() (uint64, error)

Types

type ConfigDatabase

type ConfigDatabase struct {
	Type           TypeDatabase `json:"type"`
	FileDataSource string       `json:"file_data_source"`
	Debug          bool         `json:"debug"`
	Migration      bool         `json:"migration"`
	Options        map[string]interface{}
}

func (ConfigDatabase) Postgrest

func (c ConfigDatabase) Postgrest(name string) (pg *PostgrestConfig, err error)

func (ConfigDatabase) Sqlite

func (c ConfigDatabase) Sqlite() (source string, err error)

type Database

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

func NewDatabase

func NewDatabase(config *ConfigDatabase) *Database

func (*Database) Client

func (d *Database) Client() (clientRead *ent.Client, clientWrite *ent.Client)

func (*Database) Close

func (d *Database) Close()

func (*Database) Connect

func (d *Database) Connect(ctx context.Context) error

type PostgrestConfig

type PostgrestConfig struct {
	Host     string `json:"host"`
	Port     int    `json:"port"`
	User     string
	Password string `json:"password"`
	Database string `json:"database"`
}

type TypeDatabase

type TypeDatabase string
const (
	SqliteType           TypeDatabase = "sqlite"
	PostgrestType        TypeDatabase = "postgres"
	PostgrestClusterType TypeDatabase = "postgres_cluster"
)

Jump to

Keyboard shortcuts

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