postgres

package
v0.0.0-...-19d5a8a Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(id common.RegDbID, url string) (common.Database, error)

New create new postgres reference instance

func NewInstance

func NewInstance(id common.RegDbID, reference *common.Reference, password string) (common.Database, error)

NewInstance create new postgres reference instance using reference structure

Types

type Logger

type Logger struct {
}

func NewLogger

func NewLogger() *Logger

func (*Logger) Log

func (pl *Logger) Log(ctx context.Context, level tracelog.LogLevel, msg string, data map[string]interface{})

type PostGres

type PostGres struct {
	common.CommonDatabase
	// contains filtered or unexported fields
}

PostGres instane for PostgresSQL

func (*PostGres) Batch

func (pg *PostGres) Batch(batch string) error

Batch batch SQL query in table

func (*PostGres) BatchSelect

func (pg *PostGres) BatchSelect(batch string) ([][]interface{}, error)

BatchSelect batch SQL query in table with values returned

func (*PostGres) BatchSelectFct

func (pg *PostGres) BatchSelectFct(search *common.Query, fct common.ResultFunction) error

BatchSelectFct batch SQL query in table with fct called

func (*PostGres) BeginTransaction

func (pg *PostGres) BeginTransaction() error

BeginTransaction begin transaction the database connection

func (*PostGres) ByteArrayAvailable

func (pg *PostGres) ByteArrayAvailable() bool

ByteArrayAvailable byte array available in SQL database

func (*PostGres) Clone

func (pg *PostGres) Clone() common.Database

func (*PostGres) Close

func (pg *PostGres) Close()

Close close the database connection

func (*PostGres) Commit

func (pg *PostGres) Commit() error

Commit commit the transaction

func (*PostGres) CreateTable

func (pg *PostGres) CreateTable(name string, col any) error

CreateTable create a new table

func (*PostGres) Delete

func (pg *PostGres) Delete(name string, remove *common.Entries) (rowsAffected int64, err error)

Delete Delete database records

func (*PostGres) DeleteTable

func (pg *PostGres) DeleteTable(name string) error

DeleteTable delete a table

func (*PostGres) EndTransaction

func (pg *PostGres) EndTransaction(commit bool) (err error)

func (*PostGres) FreeHandler

func (pg *PostGres) FreeHandler()

FreeHandler don't use the driver anymore

func (*PostGres) GetTableColumn

func (pg *PostGres) GetTableColumn(tableName string) ([]string, error)

GetTableColumn get table columne names

func (*PostGres) ID

func (pg *PostGres) ID() common.RegDbID

ID current id used

func (*PostGres) IndexNeeded

func (pg *PostGres) IndexNeeded() bool

IndexNeeded index needed for the SELECT statement value reference

func (*PostGres) Insert

func (pg *PostGres) Insert(name string, insert *common.Entries) (returning [][]any, err error)

Insert insert record into table

func (*PostGres) Maps

func (pg *PostGres) Maps() ([]string, error)

Maps database maps, tables or views

func (*PostGres) Open

func (pg *PostGres) Open() (dbOpen any, err error)

Open open the database connection

func (*PostGres) ParseRows

func (pg *PostGres) ParseRows(search *common.Query, rows pgx.Rows, f common.ResultFunction) (result *common.Result, err error)

func (*PostGres) ParseStruct

func (pg *PostGres) ParseStruct(search *common.Query, rows pgx.Rows, f common.ResultFunction) (result *common.Result, err error)

func (*PostGres) Ping

func (pg *PostGres) Ping() error

Ping create short test database connection

func (*PostGres) Query

func (pg *PostGres) Query(search *common.Query, f common.ResultFunction) (*common.Result, error)

Query query database records with search or SELECT

func (*PostGres) Reference

func (pg *PostGres) Reference() (string, string)

Reference reference to postgres URL

func (*PostGres) Rollback

func (pg *PostGres) Rollback() error

Rollback rollback the transaction

func (*PostGres) SetCredentials

func (pg *PostGres) SetCredentials(user, password string) error

SetCredentials set credentials to connect to database

func (*PostGres) StartTransaction

func (pg *PostGres) StartTransaction() (pgx.Tx, context.Context, error)

StartTransaction start transaction

func (*PostGres) Stream

func (pg *PostGres) Stream(search *common.Query, sf common.StreamFunction) error

func (*PostGres) URL

func (pg *PostGres) URL() string

URL current URL used

func (*PostGres) Update

func (pg *PostGres) Update(name string, updateInfo *common.Entries) (returning [][]any, rowsAffected int64, err error)

Update update record in table

Jump to

Keyboard shortcuts

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