postgres

package
v1.6.0-rc.6 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2023 License: AGPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ColumnsWithDataTypes

func ColumnsWithDataTypes(columns map[string]string, prefix string) string

func Connect

func Connect(cred Credentials) (*sql.DB, error)

func Init

func Init()

func WithConfig

func WithConfig(h *Handle, config *config.Config)

Types

type Credentials

type Credentials struct {
	Host       string
	DBName     string
	User       string
	Password   string
	Port       string
	SSLMode    string
	SSLDir     string
	TunnelInfo *tunnelling.TunnelInfo
	// contains filtered or unexported fields
}

type Handle

type Handle struct {
	DB             *sql.DB
	Namespace      string
	ObjectStorage  string
	Warehouse      warehouseutils.Warehouse
	Uploader       warehouseutils.UploaderI
	ConnectTimeout time.Duration

	SkipComputingUserLatestTraits               bool
	EnableSQLStatementExecutionPlan             bool
	TxnRollbackTimeout                          time.Duration
	EnableDeleteByJobs                          bool
	SkipComputingUserLatestTraitsWorkspaceIDs   []string
	EnableSQLStatementExecutionPlanWorkspaceIDs []string
	// contains filtered or unexported fields
}

func NewHandle

func NewHandle() *Handle

func (*Handle) AddColumns

func (pg *Handle) AddColumns(tableName string, columnsInfo []warehouseutils.ColumnInfo) (err error)

func (*Handle) AlterColumn

func (*Handle) AlterColumn(_, _, _ string) (model.AlterTableResponse, error)

func (*Handle) Cleanup

func (pg *Handle) Cleanup()

func (*Handle) Connect

func (pg *Handle) Connect(warehouse warehouseutils.Warehouse) (client.Client, error)

func (*Handle) CrashRecover

func (pg *Handle) CrashRecover(warehouse warehouseutils.Warehouse) (err error)

func (*Handle) CreateSchema

func (pg *Handle) CreateSchema() (err error)

func (*Handle) CreateTable

func (pg *Handle) CreateTable(tableName string, columnMap map[string]string) (err error)

func (*Handle) DeleteBy

func (pg *Handle) DeleteBy(tableNames []string, params warehouseutils.DeleteByParams) (err error)

DeleteBy Need to create a structure with delete parameters instead of simply adding a long list of params

func (*Handle) DownloadIdentityRules

func (*Handle) DownloadIdentityRules(*misc.GZipWriter) (err error)

func (*Handle) DownloadLoadFiles

func (pg *Handle) DownloadLoadFiles(tableName string) ([]string, error)

func (*Handle) DropTable

func (pg *Handle) DropTable(tableName string) (err error)

func (*Handle) ErrorMappings

func (pq *Handle) ErrorMappings() []model.JobError

func (*Handle) FetchSchema

func (pg *Handle) FetchSchema(warehouse warehouseutils.Warehouse) (schema, unrecognizedSchema warehouseutils.SchemaT, err error)

FetchSchema queries postgres and returns the schema associated with provided namespace

func (*Handle) GetTotalCountInTable

func (pg *Handle) GetTotalCountInTable(ctx context.Context, tableName string) (int64, error)

func (*Handle) IsEmpty

func (*Handle) IsEmpty(_ warehouseutils.Warehouse) (empty bool, err error)

func (*Handle) LoadIdentityMappingsTable

func (*Handle) LoadIdentityMappingsTable() (err error)

func (*Handle) LoadIdentityMergeRulesTable

func (*Handle) LoadIdentityMergeRulesTable() (err error)

func (*Handle) LoadTable

func (pg *Handle) LoadTable(tableName string) error

func (*Handle) LoadTestTable

func (pg *Handle) LoadTestTable(_, tableName string, payloadMap map[string]interface{}, _ string) (err error)

func (*Handle) LoadUserTables

func (pg *Handle) LoadUserTables() map[string]error

func (*Handle) SetConnectionTimeout

func (pg *Handle) SetConnectionTimeout(timeout time.Duration)

func (*Handle) Setup

func (pg *Handle) Setup(
	warehouse warehouseutils.Warehouse,
	uploader warehouseutils.UploaderI,
) (err error)

func (*Handle) TestConnection

func (pg *Handle) TestConnection(warehouse warehouseutils.Warehouse) (err error)

type QueryParams

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

Jump to

Keyboard shortcuts

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