package schema import ( "encoding/json" "errors" "fmt" ) // DBVersion - type DBVersion struct { Versions []VersionInfo `json:"versions"` Test []VersionInfo `json:"test"` } // VersionInfo - type VersionInfo struct { File string `json:"file"` Version int `json:"version"` } // ReadVersions - func ReadVersions() (dbver DBVersion, err error) { f, err := Asset("schema/dbVersion.db") if err != nil { return dbver, err } err = json.Unmarshal(f, &dbver) return } // ReadSchema - func ReadSchema(name string) (q string, err error) { if len(name) == 0 { return "", errors.New("name is empty") } f, err := Asset(fmt.Sprintf("schema/%s", name)) if err != nil { return "", err } q = string(f) return }