Documentation ¶
Index ¶
- Constants
- Variables
- func AsOrder(version string) int64
- func BulkInsert(outputPath string, cols <-chan []ColVersion, wg *sync.WaitGroup)
- func Connect(path string) (db *sql.DB, err error)
- func DeriveColumnId(tableId int64, colName string) int64
- func DeriveColumnVersionId(colId int64, versionId int64) int64
- func DeriveDbId(dbName string) int64
- func DeriveLicenseId(license string, attribution string) int64
- func DeriveNoteId(note string) int64
- func DeriveTableId(table string) int64
- func DeriveTypeId(name string) int64
- func DeriveUrlId(url string) int64
- func DeriveVersionId(dbId int64, version string) int64
- func MustConnect(path string) *sql.DB
- func SemverAsOrder(v *semver.Version) (result int64)
- type ColVersion
- type Column
- type Database
- type License
- type Note
- type Nullability
- type Table
- type Type
- type Url
- type Version
Constants ¶
View Source
const ( InsertDbQ = "INSERT INTO dbs(id, name) VALUES (?, ?) ON CONFLICT DO NOTHING;" InsertTableQ = "INSERT INTO tables(id, name) VALUES (?, ?) ON CONFLICT DO NOTHING;" InsertTypeQ = "INSERT INTO types(id, name) VALUES (?, ?) ON CONFLICT DO NOTHING;" InsertUrlQ = "INSERT INTO urls(id, url) VALUES (?, ?) ON CONFLICT DO NOTHING;" InsertNoteQ = "INSERT INTO notes(id, note) VALUES (?, ?) ON CONFLICT DO NOTHING;" InsertColumnQ = "INSERT INTO columns(id, table_id, name) VALUES (?, ?, ?) " + "ON CONFLICT DO NOTHING;" InsertVersionQ = "INSERT INTO versions(id, db_id, version, is_current, version_order) " + "VALUES (?, ?, ?, ?, ?) ON CONFLICT DO UPDATE SET" + " is_current = coalesce(excluded.is_current, is_current)" + " , version_order = coalesce(excluded.version_order, version_order);" InsertLicenseQ = "INSERT INTO licenses(id, license, attribution, url_id) " + "VALUES (?, ?, ?, ?) ON CONFLICT DO NOTHING;" // ? InsertColumnVersionQ = "INSERT INTO column_versions(" + "id, column_id, version_id, type_id, nullable, url_id, note_id, note_license_id" + ") VALUES (?, ?, ?, ?, ?, ?, ?, ?) ON CONFLICT(id) DO UPDATE SET" + " type_id = coalesce(excluded.type_id, type_id)" + " , url_id = coalesce(excluded.url_id, url_id)" + " , note_id = coalesce(excluded.note_id, note_id)" + " , note_license_id = coalesce(excluded.note_license_id, note_license_id);" )
Variables ¶
View Source
var Schema string
Functions ¶
func BulkInsert ¶
func BulkInsert(outputPath string, cols <-chan []ColVersion, wg *sync.WaitGroup)
func DeriveColumnId ¶
func DeriveColumnVersionId ¶
func DeriveDbId ¶
func DeriveLicenseId ¶
func DeriveNoteId ¶
func DeriveTableId ¶
func DeriveTypeId ¶
func DeriveUrlId ¶
func DeriveVersionId ¶
func MustConnect ¶
func SemverAsOrder ¶
func SemverAsOrder(v *semver.Version) (result int64)
pack major.minor[.patch] numbers into a single int64
Types ¶
type ColVersion ¶
type ColVersion struct { DbVersion *Version Column *Column Type *Type Notes *Note Url *Url Nullable Nullability Number int }
func (ColVersion) Clone ¶
func (c ColVersion) Clone() ColVersion
func (ColVersion) Id ¶
func (c ColVersion) Id() int64
type Nullability ¶
type Nullability int8
const ( Unknown Nullability = -1 Nullable Nullability = 0 NotNullable Nullability = 1 )
func FromBool ¶
func FromBool(nullable *bool) Nullability
func FromString ¶
func FromString(nullable string) Nullability
func (Nullability) ToBool ¶
func (n Nullability) ToBool() *bool
Click to show internal directories.
Click to hide internal directories.