database

package
v0.0.0-...-442a4c8 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2018 License: MIT Imports: 12 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewGORMClient

func NewGORMClient() (*gorm.DB, error)

InitGORMClient initializes the main client using the configuration of the application

func NewPgxMutex

func NewPgxMutex(db *PgxClient) *pgxMutex

newMutex returns a new Mutex

Types

type PgxClient

type PgxClient struct {
	Conn *pgx.ConnPool
}

PgxClient represents a pgx client

func NewImportClient

func NewImportClient() (*PgxClient, error)

NewImportClient creates a new PgxClient from the configuration

type PgxCopyFrom

type PgxCopyFrom struct {
	Path string
	File *os.File

	CallBackTriggerOnColName []string
	CallBackFunc             func(colValue string) (interface{}, error)
	// contains filtered or unexported fields
}

pgxCopyFrom is a struct helper to import a CSV file to the database It implement's the pgx.Copy interface

func (*PgxCopyFrom) Err

func (c *PgxCopyFrom) Err() error

Err returns any error that has been encountered by the CopyFromSource. If this is not nil *Conn.CopyFrom will abort the copy. Satisfies the pgx.CopyFromSource interface

func (*PgxCopyFrom) Next

func (c *PgxCopyFrom) Next() bool

Next returns true if there is another row and makes the next row data available to Values(). When there are no more rows available or an error has occurred it returns false. Satisfies the pgx.CopyFromSource interface

func (*PgxCopyFrom) Prepare

func (c *PgxCopyFrom) Prepare() error

Prepare opens the file and prepares the reader

func (*PgxCopyFrom) Values

func (c *PgxCopyFrom) Values() ([]interface{}, error)

Values returns the values for the current row. Satisfies the pgx.CopyFromSource interface

Jump to

Keyboard shortcuts

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