sql

package
v0.0.0-...-f4159b9 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MigrateDatabase

func MigrateDatabase(opts ...Option) error

MigrateDatabase performs a database migration

func New

func New(opts ...Option) (*sql.DB, error)

New initializes a new database connection

func NewNullString

func NewNullString(s string) sql.NullString

NewNullString converts a string to sql.NullString

func NewNullTime

func NewNullTime(s time.Time) sql.NullTime

NewNullTime converts time.Time to sql.NullTime

func NewNullTimePB

func NewNullTimePB(s *timestamppb.Timestamp) sql.NullTime

NewNullTimePB converts a timestamppb.Timestamp to sql.NullString

func ParseSQLError

func ParseSQLError(err error) error

ParseSQLError turns mysql errors into codes

Types

type Option

type Option func(*options)

Option provides a function definition to set options

func WithDatabaseType

func WithDatabaseType(p string) Option

WithDatabaseType sets the db type.

func WithHost

func WithHost(p string) Option

WithHost sets the db host.

func WithName

func WithName(p string) Option

WithName sets the db name.

func WithPassword

func WithPassword(p string) Option

WithPassword sets the db password.

func WithPort

func WithPort(p int) Option

WithPort sets the listener port.

func WithTLSMode

func WithTLSMode(p string) Option

WithTLSMode sets the tls mode

func WithUsername

func WithUsername(p string) Option

WithUsername sets the db username.

func WithViper

func WithViper(args ...string) Option

WithViper specifies that the server should construct its options using viper.

Jump to

Keyboard shortcuts

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