postgres

package
v0.0.0-...-a5a05a9 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2024 License: BSD-3-Clause Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	STEP_INSERT      = "INSERT INTO steps (flowinstanceid, stepid, taskname, status, starttime, endtime, stepdata) VALUES ($1,$2,$3,$4,$5,$6,$7);"
	SNAPSHOT_INSERT  = "INSERT INTO snapshopt (flowinstanceid, hostid, stepid, starttime, endtime, stepdata) VALUES ($1,$2,$3,$4,$5,$6);"
	FlowState_INSERT = "" /* 130-byte string literal not displayed */
	UpdateFlowState  = "UPDATE flowstate set endtime=$1,status=$2 where flowinstanceid = $3;"

	UpsertSteps = "" /* 281-byte string literal not displayed */
)

Variables

This section is empty.

Functions

func EvaluateQuery

func EvaluateQuery(query string, inputData Input) (string, []interface{}, []string, error)

EvaluateQuery ... consider query:insert into users(?name, ?id) values(?name, ?id), inputData.values=[('john', 'id')]

func New

func New(actionerr ActionError) error

New ..

func NewDB

func NewDB(settings map[string]interface{}) (*sql.DB, error)

func QueryBasicCheck

func QueryBasicCheck(s string) error

QueryBasicCheck ..

Types

type ActionError

type ActionError struct {
	APIName string         `json:"APIName"`
	Diag    []DBDiagnostic `json:"Diag,omitempty"`
}

ActionError ..

func (*ActionError) Error

func (acterr *ActionError) Error() string

type Connection

type Connection struct {
	DatabaseURL string `json:"databaseURL"`
	Host        string `json:"host"`
	Port        int    `json:"port"`
	User        string `json:"user"`
	Password    string `json:"password"`
	DbName      string `json:"databaseName"`
	SSLMode     string `json:"sslmode"`
	// contains filtered or unexported fields
}

Connection datastructure for storing PostgreSQL connection details

func (*Connection) Login

func (con *Connection) Login() (err error)

Login connects to the the postgres database cluster using the connection details provided in Connection configuration

func (*Connection) Logout

func (con *Connection) Logout() (err error)

Logout the database connection

type Connector

type Connector struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
	Title       string `json:"title"`
	Version     string `json:"version"`
	Type        string `json:"type"`
	Ref         string `json:"ref"`
	Settings    []struct {
		Name  string      `json:"name"`
		Type  string      `json:"type"`
		Value interface{} `json:"value"`
	} `json:"settings"`
}

Connector is a representation of connector.json metadata for the postgres connection

type DBDiagnostic

type DBDiagnostic struct {
	State       string `json:"State"`
	NativeError string `json:"NativeError"`
	Messge      string `json:"Message"`
}

DBDiagnostic ..

type Input

type Input struct {
	Parameters map[string]interface{}   `json:"parameters,omitempty"`
	Values     []map[string]interface{} `json:"values,omitempty"`
}

Input is a representation of acitivity's input parametres

type PgFactory

type PgFactory struct {
}

PgFactory for postgres connection

func (*PgFactory) Type

func (*PgFactory) Type() string

Type PgFactory

type PgSharedConfigManager

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

func (*PgSharedConfigManager) PreparedDelete

func (p *PgSharedConfigManager) PreparedDelete(queryString string, inputData *Input, logCache log.Logger) (results map[string]interface{}, err error)

PreparedDelete allows to delete records

func (*PgSharedConfigManager) PreparedInsert

func (p *PgSharedConfigManager) PreparedInsert(queryString string, inputData *Input, fields interface{}, logCache log.Logger) (results *ResultSet, err error)

PreparedInsert allows querying database with named parameters

func (*PgSharedConfigManager) PreparedQuery

func (p *PgSharedConfigManager) PreparedQuery(queryString string, inputData *Input, logCache log.Logger) (results *ResultSet, err error)

PreparedQuery allows querying database with named parameters

func (*PgSharedConfigManager) PreparedUpdate

func (p *PgSharedConfigManager) PreparedUpdate(queryString string, inputData *Input, fields interface{}, logCache log.Logger) (results *ResultSet, err error)

PreparedUpdate allows updating database with named parameters

type Query

type Query struct {
	TableName string            `json:"tableName"`
	Cols      []string          `json:"columns"`
	Filters   map[string]string `json:"filters"`
}

Query structure for SQL Queries

type QueryActivity

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

QueryActivity provides Activity metadata for Flogo

type Recd

type Recd map[string]interface{}

record is the one row of the ResultSet retrieved from database after execution of SQL Query

type ResultSet

type ResultSet struct {
	Record []*Recd `json:"records"`
}

ResultSet is an aggregation of SQL Query data records fetched from the database

func UnmarshalRows

func UnmarshalRows(rows *sql.Rows) (results *ResultSet, err error)

UnmarshalRows function

type StatefulDB

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

func (*StatefulDB) InsertFlowState

func (s *StatefulDB) InsertFlowState(flowState *state.FlowState) (results *ResultSet, err error)

func (*StatefulDB) InsertSteps

func (s *StatefulDB) InsertSteps(step *state.Step) (results *ResultSet, err error)

func (*StatefulDB) UpdateFlowState

func (s *StatefulDB) UpdateFlowState(flowState *state.FlowState) (results *ResultSet, err error)

type StepStore

type StepStore struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewStore

func NewStore(settings map[string]interface{}) (*StepStore, error)

func (*StepStore) Delete

func (s *StepStore) Delete(flowId string)

func (*StepStore) GetFailedFlows

func (s *StepStore) GetFailedFlows(metadata *metadata.Metadata) ([]*state.FlowInfo, error)

func (*StepStore) GetFlow

func (s *StepStore) GetFlow(flowid string, metadata *metadata.Metadata) (*state.FlowInfo, error)

func (*StepStore) GetFlows

func (s *StepStore) GetFlows(metadata *metadata.Metadata) ([]*state.FlowInfo, error)

func (*StepStore) GetSnapshot

func (s *StepStore) GetSnapshot(flowId string) *state.Snapshot

func (*StepStore) GetStatus

func (s *StepStore) GetStatus(flowId string) int

func (*StepStore) GetSteps

func (s *StepStore) GetSteps(flowId string) ([]*state.Step, error)

func (*StepStore) GetStepsNoData

func (s *StepStore) GetStepsNoData(flowId string) ([]map[string]string, error)

func (*StepStore) RecordEnd

func (s *StepStore) RecordEnd(flowState *state.FlowState) error

func (*StepStore) RecordStart

func (s *StepStore) RecordStart(flowState *state.FlowState) error

func (*StepStore) SaveSnapshot

func (s *StepStore) SaveSnapshot(snapshot *state.Snapshot) error

func (*StepStore) SaveStep

func (s *StepStore) SaveStep(step *state.Step) error

Jump to

Keyboard shortcuts

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