sql

package
v0.3.7 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2018 License: MIT Imports: 11 Imported by: 0

README

Nibbler SQL

Requires models that are to be migrated to be provided before init.

Assumes models use GORM, currently. Future enhancements will guarantee that GORM models will work for non-GORM-supported SQL DBs (if that's a thing).

Will pull DB connection info and credentials from SQL_URL. If not found, it will try DATABASE_URL, then DB_URL.

If any part of the needed credentials are not obtained at that stage, it will use:

DB_DIALECT DB_USER DB_PASSWORD DB_DBNAME

At present, the dialects available are limited to postgres, sqlite3. If none is detected, sqlite3 will be used (in memory). For example, you could use sqlite3 to connect to a file with SQL_URL=sqlite3:///tmp/test.db or something like postgres://test:test@localhost:5432/test to connect via postgres.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NullifyField added in v0.3.6

func NullifyField(db *gorm.DB, field string) *gorm.DB

Types

type Configuration

type Configuration struct {
	Scheme   string
	Host     string
	Port     string
	Username string
	Password *string
	Path     string
	Query    url.Values
}

type Extension

type Extension struct {
	nibbler.Extension

	Models []interface{}
	Db     *gorm.DB
}

func (*Extension) AddRoutes

func (s *Extension) AddRoutes(app *nibbler.Application) error

func (*Extension) Destroy

func (s *Extension) Destroy(app *nibbler.Application) error

func (*Extension) Init

func (s *Extension) Init(app *nibbler.Application) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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