Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateSQLName ¶
func GenerateSQLName() string
GenerateSQLName generates a unique safe name that can be used for a database or table name
Types ¶
type SQLBuilder ¶
type SQLBuilder interface { // Select returns a SelectBuilder Select(columns ...string) squirrel.SelectBuilder // Insert returns a InsertBuilder Insert(into string) squirrel.InsertBuilder // Update returns a UpdateBuilder Update(table string) squirrel.UpdateBuilder // Delete returns a DeleteBuilder Delete(from string) squirrel.DeleteBuilder // RunWith sets the RunWith field for any child builders. RunWith(runner squirrel.BaseRunner) squirrel.StatementBuilderType }
SQLBuilder describes a basic SQL builder using the squirrel library
type SQLDB ¶
type SQLDB interface { // Query executes the given query as implemented by database/sql.Query. Query(string, ...interface{}) (*sql.Rows, error) // QueryContext executes a query that returns rows, typically a SELECT. QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) // QueryRow executes a query that is expected to return at most one row. QueryRow always returns a // non-nil value. QueryRow(string, ...interface{}) *sql.Row // QueryRowContext executes a query that is expected to return at most one row. QueryRow always // returns a non-nil value. QueryRowContext(context.Context, string, ...interface{}) *sql.Row // Exec executes a query without returning any rows. Exec(string, ...interface{}) (sql.Result, error) // ExecContext executes a query without returning any rows. ExecContext(context.Context, string, ...interface{}) (sql.Result, error) }
SQLDB is the standard SQL database interface which the standard library should have but it does not
type TraceableDB ¶
type TraceableDB interface { SQLDB tracing.Tracer // WithTrimmedQuery sets the max length of the SQL query logged in open tracing. // Depending on the chosen transport open tracing can have limitations on the length of the span // If the consumer of the interface anticipates building very long SQL queries they might want // to use this function. // `maxLength == 0` means no query will be logged in open tracing. // `maxLength > 0` does `query[:maxLength]+"..."`, so please account for 3 additional characters. WithTrimmedQuery(maxLength uint) TraceableDB }
TraceableDB is the SQL database wrapped with open tracing
func WrapWithTracing ¶
func WrapWithTracing(db SQLDB) TraceableDB
WrapWithTracing Wraps a SQL database with open tracing and logging
Directories ¶
Path | Synopsis |
---|---|
Package migrations provides standardized database migration tools.
|
Package migrations provides standardized database migration tools. |
null
Package null implements nullable sql fields that are safely marshalable from/to json and text.
|
Package null implements nullable sql fields that are safely marshalable from/to json and text. |
Click to show internal directories.
Click to hide internal directories.