github.com/titpetric/microservice/db
No package summary is available.
Package
Files: 9. Third party imports: 4. Imports from organisation: 0. Tests: 0. Benchmarks: 0.
Vars
Types
FS
FS represents a mapping between filename => contents
| Field name | Field type | Comment |
|---|---|---|
| type |
|
No comment on field. |
Credentials, ConnectionOptions
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| DSN |
|
No comment on field. |
| Driver |
|
No comment on field. |
| Credentials |
|
No comment on field. |
| Connector |
|
Connector is an optional parameter to produce our own *sql.DB, which is then wrapped in *sqlx.DB |
| Retries |
|
No comment on field. |
| RetryDelay |
|
No comment on field. |
| ConnectTimeout |
|
No comment on field. |
migration
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| Project |
|
No comment on field. |
| Filename |
|
No comment on field. |
| StatementIndex |
|
No comment on field. |
| Status |
|
No comment on field. |
Functions
func Connect
Connect connects to a database and produces the handle for injection
Uses: apmsql.Open, context.Context, os.Getenv, sql.DB.func ConnectWithOptions
ConnectWithOptions connect to host based on ConnectionOptions{}
Uses: errors.New, errors.WithStack, sqlx.ConnectContext, sqlx.DB, sqlx.NewDb.func ConnectWithRetry
ConnectWithRetry uses retry options set in ConnectionOptions{}
Uses: errors.Errorf, log.Printf, log.Println, time.After, time.Minute, time.Second.func List
List lists database migration filenames
func Print
Print outputs database migrations for a project to log output
Uses: errors.Errorf, errors.Wrap, fmt.Sprintf, log.Println.func Run
Run takes migrations for a project and executes them against a database
Uses: errors.Errorf, errors.Wrap, fmt.Sprintf, log.Println, sql.ErrNoRows, strings.Join.func (FS) Migrations
Migrations returns list of SQL files to execute
Uses: filepath.Match, sort.Strings.func (FS) ReadFile
ReadFile returns decoded file contents from FS
Uses: base64.StdEncoding, os.ErrNotExist.