postgres

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithTransaction

func WithTransaction(logger *zap.SugaredLogger, db *sqlx.DB, ctx context.Context, fn TxFn) (err error)

Types

type Client

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

func NewClient

func NewClient(
	logger *zap.SugaredLogger,
	db *sqlx.DB,
) *Client

func (*Client) CalculateRouteShapesFromTrips

func (c *Client) CalculateRouteShapesFromTrips(
	ctx context.Context,
	gtfsFeedID int,
	routeIDs []int,
) ([]RouteShapeRow, error)

func (*Client) SetRouteShapes

func (c *Client) SetRouteShapes(
	ctx context.Context,
	routeShapes []RouteShapeRow,
	gtfsFeedID int,
) error

type RouteShapeRow

type RouteShapeRow struct {
	RouteID              int    `db:"route_id"`
	DirectionID          int    `db:"direction_id"`
	LongestShapeID       int    `db:"longest_shape_id"`
	LongestShapeGeometry string `db:"longest_shape_geometry"`
	LongestShapeCentroid string `db:"longest_shape_centroid"`
}

type TransactionError

type TransactionError struct {
	RollbackNeeded bool
	Error          error
}

type TxFn

type TxFn func(ctx context.Context, tx *sqlx.Tx) *TransactionError

Jump to

Keyboard shortcuts

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