pg

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: May 15, 2023 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConnStringFromCertFiles

func ConnStringFromCertFiles(dbName, dbUser, dbHost, certFile, keyFile, caCertFile string) (string, error)

func ConnStringFromCredentials

func ConnStringFromCredentials(dbName, dbUser, dbHost string, creds Credentials) (string, error)

func ConnStringFromId

func ConnStringFromId(dbName, dbUser, dbHost, dbPassword string) (string, error)

Types

type Backend

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

Backend implements GeocubeBackend

func (Backend) AddRecordsTags

func (b Backend) AddRecordsTags(ctx context.Context, ids []string, tags geocube.Metadata) (int64, error)

AddRecordsTags add or update existing tags on list of records

func (Backend) ChangeDatasetsStatus

func (b Backend) ChangeDatasetsStatus(ctx context.Context, lockedByJobID string, fromStatus geocube.DatasetStatus, toStatus geocube.DatasetStatus) error

ChangeDatasetsStatus implements GeocubeBackend

func (Backend) ComputeValidShapeFromCell added in v0.3.0

func (b Backend) ComputeValidShapeFromCell(ctx context.Context, datasetIDS []string, cell *grid.Cell) (*proj.Shape, error)

func (Backend) CreateAOI

func (b Backend) CreateAOI(ctx context.Context, aoi *geocube.AOI) error

CreateAOI implements GeocubeBackend

func (Backend) CreateConsolidationParams

func (b Backend) CreateConsolidationParams(ctx context.Context, id string, cp geocube.ConsolidationParams) error

CreateConsolidationParams implements GeocubeBackend

func (Backend) CreateContainer

func (b Backend) CreateContainer(ctx context.Context, container *geocube.Container) error

CreateContainer implements GeocubeBackend

func (Backend) CreateDatasets

func (b Backend) CreateDatasets(ctx context.Context, datasets []*geocube.Dataset) error

CreateDatasets implements GeocubeBackend

func (Backend) CreateGrid added in v0.3.0

func (b Backend) CreateGrid(ctx context.Context, grid *geocube.Grid) (err error)

CreateGrid implements GeocubeBackend

func (Backend) CreateInstance

func (b Backend) CreateInstance(ctx context.Context, variableID string, instance *geocube.VariableInstance) error

CreateInstance implements GeocubeBackend

func (Backend) CreateJob

func (b Backend) CreateJob(ctx context.Context, job *geocube.Job) error

CreateJob implements GeocubeBackend

func (Backend) CreateLayout

func (b Backend) CreateLayout(ctx context.Context, layout *geocube.Layout) error

CreateLayout implements GeocubeBackend

func (Backend) CreatePalette

func (b Backend) CreatePalette(ctx context.Context, palette *geocube.Palette) error

CreatePalette implements GeocubeBackend

func (Backend) CreateRecords

func (b Backend) CreateRecords(ctx context.Context, records []*geocube.Record) (err error)

CreateRecords implements GeocubeBackend

func (Backend) CreateTasks

func (b Backend) CreateTasks(ctx context.Context, jobID string, tasks []*geocube.Task) error

CreateTasks implements GeocubeBackend

func (Backend) CreateVariable

func (b Backend) CreateVariable(ctx context.Context, variable *geocube.Variable) error

CreateVariable implements GeocubeBackend

func (Backend) DeleteConsolidationParams

func (b Backend) DeleteConsolidationParams(ctx context.Context, id string) error

DeleteConsolidationParams implements geocubeBackend

func (Backend) DeleteContainer

func (b Backend) DeleteContainer(ctx context.Context, container *geocube.Container) error

DeleteContainer implements GeocubeBackend

func (Backend) DeleteContainerLayout added in v0.4.1

func (b Backend) DeleteContainerLayout(ctx context.Context, containerURI string) error

DeleteContainerLayout implements GeocubeBackend

func (Backend) DeleteDatasets

func (b Backend) DeleteDatasets(ctx context.Context, datasetsID []string) error

DeleteDatasets implements GeocubeBackend

func (Backend) DeleteGrid added in v0.3.0

func (b Backend) DeleteGrid(ctx context.Context, gridName string) error

DeleteGrid implements GeocubeBackend

func (Backend) DeleteInstance

func (b Backend) DeleteInstance(ctx context.Context, instanceID string) error

DeleteInstance implements GeocubeBackend

func (Backend) DeleteJob

func (b Backend) DeleteJob(ctx context.Context, jobID string) error

DeleteJob implements GeocubeBackend

func (Backend) DeleteLayout

func (b Backend) DeleteLayout(ctx context.Context, name string) error

DeleteLayout implements GeocubeBackend

func (Backend) DeletePalette

func (b Backend) DeletePalette(ctx context.Context, name string) error

DeletePalette implements GeocubeBackend

func (Backend) DeletePendingAOIs

func (b Backend) DeletePendingAOIs(ctx context.Context) (int64, error)

DeletePendingAOIs implements GeocubeBackend

func (Backend) DeletePendingConsolidationParams

func (b Backend) DeletePendingConsolidationParams(ctx context.Context) (int64, error)

DeletePendingConsolidationParams implements GeocubeBackend

func (Backend) DeletePendingContainers

func (b Backend) DeletePendingContainers(ctx context.Context) (int64, error)

DeletePendingContainers implements GeocubeBackend

func (Backend) DeletePendingInstances

func (b Backend) DeletePendingInstances(ctx context.Context) (int64, error)

DeletePendingInstances implements GeocubeBackend

func (Backend) DeletePendingRecords

func (b Backend) DeletePendingRecords(ctx context.Context) (int64, error)

DeletePendingRecords implements GeocubeBackend

func (Backend) DeletePendingVariables

func (b Backend) DeletePendingVariables(ctx context.Context) (int64, error)

DeletePendingVariables implements GeocubeBackend

func (Backend) DeleteRecords

func (b Backend) DeleteRecords(ctx context.Context, ids []string) (int64, error)

DeleteRecords implements GeocubeBackend

func (Backend) DeleteTask

func (b Backend) DeleteTask(ctx context.Context, taskID string) error

DeleteTask implements GeocubeBackend

func (Backend) DeleteVariable

func (b Backend) DeleteVariable(ctx context.Context, variableID string) error

DeleteVariable implements GeocubeBackend

func (Backend) FindCells added in v0.3.0

func (b Backend) FindCells(ctx context.Context, gridName string, aoi *geocube.AOI) ([]geocube.Cell, []geom.MultiPolygon, error)

FindCells implements GeocubeBackend Returns the cells and the intersection with the AOI

func (Backend) FindContainerLayouts added in v0.5.1

func (b Backend) FindContainerLayouts(ctx context.Context, instanceId string, geomAOI *geocube.AOI, recordIds []string, recordTags map[string]string, fromTime, toTime time.Time) ([]string, [][]string, error)

FindContainerLayouts implements GeocubeBackend

func (Backend) FindDatasets

func (b Backend) FindDatasets(ctx context.Context, status geocube.DatasetStatus, containerURIPatterns []string, lockedByJobID string, instancesID, recordsID []string,
	recordTags geocube.Metadata, fromTime, toTime time.Time, geog *proj.GeographicRing, refined *proj.Ring, page, limit int, order bool) (datasets []*geocube.Dataset, err error)

FindDatasets implements GeocubeBackend

func (Backend) FindGrids added in v0.3.0

func (b Backend) FindGrids(ctx context.Context, nameLike string) ([]*geocube.Grid, error)

FindGrids implements GeocubeBackend

func (Backend) FindJobs

func (b Backend) FindJobs(ctx context.Context, nameLike string) ([]*geocube.Job, error)

FindJobs implements GeocubeBackend

func (Backend) FindLayouts

func (b Backend) FindLayouts(ctx context.Context, nameLike string) ([]*geocube.Layout, error)

FindLayouts implements GeocubeBackend

func (Backend) FindRecords

func (b Backend) FindRecords(ctx context.Context, namelike string, tags geocube.Metadata, fromTime, toTime time.Time, jobID string, aoi *geocube.AOI, page, limit int, order, loadAOI bool) (records []*geocube.Record, err error)

FindRecords implements GeocubeBackend

func (Backend) FindVariables

func (b Backend) FindVariables(ctx context.Context, namelike string, page, limit int) ([]*geocube.Variable, error)

FindVariables implements GeocubeBackend

func (Backend) GetDatasetsGeometryUnion added in v0.3.0

func (b Backend) GetDatasetsGeometryUnion(ctx context.Context, lockedByJobID string) (*geom.MultiPolygon, error)

GetDatasetsGeometryUnion implements GeocubeBackend

func (Backend) GetUnionAOI

func (b Backend) GetUnionAOI(ctx context.Context, recordsID []string) (*geom.MultiPolygon, error)

GetUnionAOI implements GeocubeBackend

func (Backend) ListActiveDatasetsID

func (b Backend) ListActiveDatasetsID(ctx context.Context, instanceID string, recordsID []string, recordTags geocube.Metadata, fromTime, toTime time.Time) ([]string, error)

ListActiveDatasetsID implements GeocubeBackend ListActiveDatasetsID retrieves all the datasets from the list of records representing the given variable

func (Backend) ListJobsID

func (b Backend) ListJobsID(ctx context.Context, nameLike string, states []geocube.JobState) ([]string, error)

ListJobsID implements GeocubeBackend

func (Backend) LockDatasets

func (b Backend) LockDatasets(ctx context.Context, lockedByJobID string, datasetsID []string, flag int) (err error)

LockDatasets implements GeocubeBackend

func (Backend) PersistLogs added in v0.6.0

func (b Backend) PersistLogs(ctx context.Context, jobID string, logs geocube.JobLogs) error

func (Backend) ReadAOI

func (b Backend) ReadAOI(ctx context.Context, aoiID string) (*geocube.AOI, error)

ReadAOI implements GeocubeBackend

func (Backend) ReadConsolidationParams

func (b Backend) ReadConsolidationParams(ctx context.Context, id string) (*geocube.ConsolidationParams, error)

ReadConsolidationParams implements geocubeBackend

func (Backend) ReadContainers

func (b Backend) ReadContainers(ctx context.Context, containersURI []string) (containers []*geocube.Container, err error)

ReadContainers implements GeocubeBackend

func (Backend) ReadGrid added in v0.3.0

func (b Backend) ReadGrid(ctx context.Context, name string) (*geocube.Grid, error)

ReadGrid implements GeocubeBackend

func (Backend) ReadJob

func (b Backend) ReadJob(ctx context.Context, jobID string, opts ...database.ReadJobOptions) (*geocube.Job, error)

ReadJob implements GeocubeBackend

func (Backend) ReadJobWithTask

func (b Backend) ReadJobWithTask(ctx context.Context, jobID string, taskID string) (*geocube.Job, error)

ReadJobWithTask implements GeocubeBackend

func (Backend) ReadLayout

func (b Backend) ReadLayout(ctx context.Context, name string) (*geocube.Layout, error)

ReadLayout implements GeocubeBackend

func (Backend) ReadPalette

func (b Backend) ReadPalette(ctx context.Context, name string) (*geocube.Palette, error)

ReadPalette implements GeocubeBackend

func (Backend) ReadRecords

func (b Backend) ReadRecords(ctx context.Context, ids []string) (records []*geocube.Record, err error)

ReadRecords implements GeocubeBackend

func (Backend) ReadTasks

func (b Backend) ReadTasks(ctx context.Context, jobID string, states []geocube.TaskState) (tasks []*geocube.Task, err error)

ReadTasks implements GeocubeBackend

func (Backend) ReadVariable

func (b Backend) ReadVariable(ctx context.Context, variableID string) (*geocube.Variable, error)

ReadVariable implements GeocubeBackend

func (Backend) ReadVariableFromInstanceID

func (b Backend) ReadVariableFromInstanceID(ctx context.Context, instanceID string) (*geocube.Variable, error)

ReadVariableFromInstanceID implements GeocubeBackend

func (Backend) ReadVariableFromName

func (b Backend) ReadVariableFromName(ctx context.Context, variableName string) (*geocube.Variable, error)

ReadVariableFromName implements GeocubeBackend

func (Backend) ReleaseDatasets

func (b Backend) ReleaseDatasets(ctx context.Context, lockedByJobID string, flag int) error

ReleaseDatasets implements GeocubeBackend

func (Backend) RemoveRecordsTags

func (b Backend) RemoveRecordsTags(ctx context.Context, ids []string, tagsKey []string) (int64, error)

RemoveRecordsTags remove tags on list of records

func (Backend) SaveContainerLayout added in v0.3.0

func (b Backend) SaveContainerLayout(ctx context.Context, containerURI string, layoutName string) error

SaveContainerLayout implements GeocubeBackend

func (Backend) UpdateContainer

func (b Backend) UpdateContainer(ctx context.Context, container *geocube.Container) error

UpdateContainer implements GeocubeBackend

func (Backend) UpdateDatasets

func (b Backend) UpdateDatasets(ctx context.Context, instanceID string, recordIds []string, dmapping geocube.DataMapping) (map[string]int64, error)

UpdateDatasets implements GeocubeBackend

func (Backend) UpdateInstance

func (b Backend) UpdateInstance(ctx context.Context, instance *geocube.VariableInstance) error

UpdateInstance updates the name and the metadata of the instance in the database

func (Backend) UpdateJob

func (b Backend) UpdateJob(ctx context.Context, job *geocube.Job) error

UpdateJob implements GeocubeBackend

func (Backend) UpdatePalette

func (b Backend) UpdatePalette(ctx context.Context, palette *geocube.Palette) error

UpdatePalette implements GeocubeBackend

func (Backend) UpdateTask

func (b Backend) UpdateTask(ctx context.Context, task *geocube.Task) error

UpdateTask implements GeocubeBackend

func (Backend) UpdateVariable

func (b Backend) UpdateVariable(ctx context.Context, variable *geocube.Variable) error

UpdateVariable implements GeocubeBackend

type BackendDB

type BackendDB struct {
	*sql.DB
	Backend
}

BackendDB implements GeocubeDBBackend

func New

func New(ctx context.Context, dbConnection string) (*BackendDB, error)

func (BackendDB) StartTransaction

func (bdb BackendDB) StartTransaction(ctx context.Context) (database.GeocubeTxBackend, error)

StartTransaction implements GeocubeDBBackend

type BackendTx

type BackendTx struct {
	*sql.Tx
	Backend
}

BackendTx implements GeocubeTxBackend

func (BackendTx) Rollback

func (btx BackendTx) Rollback() error

Rollback overloads sql.Tx.Rollback to be idempotent

type Credentials

type Credentials struct {
	Cert   string `json:"apiserver.crt"`
	Key    string `json:"apiserver.key"`
	CaCert string `json:"root.crt"`
}

Jump to

Keyboard shortcuts

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