Create tables, indexes, functions and triggers programatically

This commit is contained in:
Las Zenow 2017-09-21 21:05:06 +00:00
parent cc12981a50
commit c9b967a2ef
7 changed files with 154 additions and 163 deletions

View file

@ -9,7 +9,7 @@ import (
// Book metadata
type Book struct {
ID string
ID string `sql:"type:varchar(16)"`
Title string
Authors []string `sql:"authors" pg:",array"`
Contributor string
@ -17,13 +17,13 @@ type Book struct {
Description string
Tags []string `sql:"tags" pg:",array"`
Date string
Lang string
Isbn string
FileSize int
Cover bool `sql:",notnull"`
Active bool `sql:",notnull"`
UploadDate time.Time
Tsv string
Lang string `sql:"type:varchar(3)"`
Isbn string `sql:"type:varchar(13)"`
FileSize int `sql:"type:integer"`
Cover bool `sql:",notnull"`
Active bool `sql:",notnull"`
UploadDate time.Time `sql:"type:timestamp"`
Tsv string `sql:"type:tsvector"`
Visit *Visit
}