pgdb

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeUpsertQuery

func MakeUpsertQuery(qc QueryConfig, returnPK bool) string

MakeUpsertQuery builds the upsert query using the QueryConfig struct. The following is an example of the upsert query used for writing data to the models table: 'INSERT INTO models.hms (name, data_group, type, collection_id, s3_key, model_metadata, etl_metadata) VALUES ($1, $2, $3, $4, $5, $6, $7) ON CONFLICT (s3_key) DO UPDATE SET name = $1, data_group = $2, type = $3, collection_id = $4, s3_key = $5, model_metadata = $6, etl_metadata = $7;'

func RefreshHMSViews

func RefreshHMSViews(db *sqlx.DB) echo.HandlerFunc

RefreshHMSViews ...

func UpsertHMSModel

func UpsertHMSModel(ac *config.APIConfig) echo.HandlerFunc

Upsert ...

func UpsertToDB

func UpsertToDB(definitionFile string, ac *config.APIConfig) (err error)

Upsert extracts metadata from a HEC-HMS model and writes this data to a database using upsert statements. These upsert statements insert a row where it does not exist, or updates the row with new values when it does. A database transaction is used so that in the case of an error, no model data is written to the database, i.e. the transation is aborted, which prevents incomplete tables for a given model. Furthermore, tx.Get is used so that the primary key from one table is returned and can be used as a foreign key in subsequent tables.

func VacuumHMSViews

func VacuumHMSViews(db *sqlx.DB) echo.HandlerFunc

VacuumHMSViews ...

Types

type QueryConfig

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

QueryConfig ...

Jump to

Keyboard shortcuts

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