anyrow

package module
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: MIT Imports: 14 Imported by: 0

README

anyrow - fetches generic data row(s) with metadata

Uses pgx.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FetchColumns added in v0.8.0

func FetchColumns(ctx context.Context, conn Querier, tableName string) ([]*pb.ColumnSchema, error)

FetchColumns returns a list of column schemas for a public tablename.

func FetchRowSet

func FetchRowSet(ctx context.Context, conn Querier, metadataCacheKey, tableName string, pkv PrimaryKeysAndValues) (*pb.RowSet, error)

FetchObjects returns a protobuf RowSet for the given list primary key values.

func FetchSchemas added in v0.13.0

func FetchSchemas(ctx context.Context, conn Querier) ([]string, error)

func FetchTableNames added in v0.8.0

func FetchTableNames(ctx context.Context, conn Querier, schema string) ([]string, error)

FetchTablenames returns a list of public tablenames.

func FilterLimit

func FilterLimit(limit int) filterOption

Types

type PrimaryKeyAndValue added in v0.11.0

type PrimaryKeyAndValue struct {
	Column string
	Value  any
}

func NewPrimaryKeyAndValue added in v0.11.0

func NewPrimaryKeyAndValue(column string, value any) PrimaryKeyAndValue

NewPrimaryKeyAndValue creates a parameter object.

type PrimaryKeysAndValues added in v0.11.0

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

PrimaryKeysAndValues is a parameter object holding the column name(s) and one or more values.

func NewPrimaryKeyAndValues added in v0.11.0

func NewPrimaryKeyAndValues(column string, value ...any) PrimaryKeysAndValues

NewPrimaryKeyAndValues creates a parameter object.

func NewPrimaryKeysAndValues added in v0.11.0

func NewPrimaryKeysAndValues(pairs []PrimaryKeyAndValue) PrimaryKeysAndValues

MewPrimaryKeysAndValues creates a parameter object.

type Querier

type Querier interface {
	Query(ctx context.Context, sql string, args ...any) (pgx.Rows, error)
}

Querier is the interface that is used from a database connection. Known implementations are *pgx.Conn and *pgx.Tx and *pgxpool.Conn.

type Record added in v0.16.0

type Record map[string]any

Record represents a Table row as a Map.

func FetchRecords added in v0.16.0

func FetchRecords(ctx context.Context, conn Querier, metadataCacheKey, tableName string, pkv PrimaryKeysAndValues) ([]Record, error)

FetchRecords returns a list of Objects (generic maps) for the given list primary key values.

func FilterRecords added in v0.16.0

func FilterRecords(ctx context.Context, conn Querier, metadataCacheKey, tableName string, where string, options ...filterOption) ([]Record, error)

FilterRecords queries a table using a WHERE clause. Unless option is given, the limit is 1000.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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