postgres

package
v1.0.33 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Copyright © 2020 Marvin

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Query

func Query(ctx context.Context, db *sql.DB, querySQL string) ([]string, []map[string]string, error)

Types

type Postgres

type Postgres struct {
	Ctx  context.Context
	PGDB *sql.DB
}

func NewPostgresEngine

func NewPostgresEngine(ctx context.Context, dbUser, dbPassword, ipAddr, dbPort, dbName string) (*Postgres, error)

func (*Postgres) GetSchemaMeta

func (p *Postgres) GetSchemaMeta() (schemaMeta []string)

func (*Postgres) GetTableColumnMeta

func (p *Postgres) GetTableColumnMeta(schemaName string, tableName string) (colMeta []map[string]string)

func (*Postgres) GetTableForeignKey

func (p *Postgres) GetTableForeignKey(schemaName string, tableName string) (fkList []map[string]string)

func (*Postgres) GetTableIndexMeta

func (p *Postgres) GetTableIndexMeta(schemaName string, tableName string) (idxMeta []map[string]string)

func (*Postgres) GetTableMeta

func (p *Postgres) GetTableMeta(schemaName string) (tableMeta []map[string]string)

func (*Postgres) GetTablePrimaryKey

func (p *Postgres) GetTablePrimaryKey(schemaName string, tableName string) (pkList []map[string]string)

func (*Postgres) GetTableUniqueKey

func (p *Postgres) GetTableUniqueKey(schemaName string, tableName string) (ukList []map[string]string)

func (*Postgres) GetViewMeta

func (p *Postgres) GetViewMeta(schemaName, viewName string) (viewMeta []map[string]string)

func (*Postgres) QuerySQL

func (p *Postgres) QuerySQL(querySQL string) (cols []string, res []map[string]string)

Jump to

Keyboard shortcuts

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