dbhelper

package
v0.3.680 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package dbhelper wraps SQL and specific capabilities of an SQL db

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(helper Helper)

Register registers a new SQL helper

Types

type Helper

type Helper interface {
	fmt.Stringer
	// Supports indicates if this helper supports this driver name
	Supports(driverName string) bool
	// PreConnect calculates the connect URL for the db from a canonical URL used in Fn config
	PreConnect(url *url.URL) (string, error)
	// PostCreate  Apply any configuration to the DB prior to use
	PostCreate(db *sqlx.DB) (*sqlx.DB, error)
	// CheckTableExists checks if a table exists in the DB
	CheckTableExists(tx *sqlx.Tx, table string) (bool, error)
	// IsDuplicateKeyError determines if an error indicates if the prior error was caused by a duplicate key insert
	IsDuplicateKeyError(err error) bool
}

Helper provides DB-specific SQL capabilities

func GetHelper

func GetHelper(driverName string) (Helper, bool)

GetHelper returns a helper for a specific driver

Jump to

Keyboard shortcuts

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