Documentation
¶
Overview ¶
Example (GenerateWithSchema) ¶
package main
import (
"context"
"fmt"
"github.com/Jumpaku/schenerate/files"
"github.com/Jumpaku/schenerate/sqlite3"
)
func main() {
q, err := sqlite3.Open("db.sqlite")
if err != nil {
panic(err)
}
defer q.Close()
err = sqlite3.GenerateWithSchema(context.Background(), q,
[]string{"Table"},
func(w *files.Writer, schemas sqlite3.Schemas) error {
for _, schema := range schemas {
// do something with schemas
w.Add(schema.Name)
fmt.Fprintf(w, "%+v\n", schema.Name)
}
return nil
},
)
if err != nil {
panic(err)
}
}
Output:
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateWithSchema ¶
Types ¶
type ForeignKey ¶
type ForeignKey struct {
Key []string
Reference ForeignKeyReference
}
type ForeignKeyReference ¶
type Index ¶
type Index struct {
Name string
Origin IndexOrigin
Unique bool
Key []IndexKeyElem
}
type IndexKeyElem ¶
type IndexOrigin ¶
type IndexOrigin string
IndexOrigin is a type for the origin of an index. https://www.sqlite.org/pragma.html#pragma_index_list > "c" if the index was created by a CREATE INDEX statement, "u" if the index was created by a UNIQUE constraint, or "pk" if the index was created by a PRIMARY KEY constraint.
const ( IndexOriginPrimaryKey IndexOrigin = "pk" IndexOriginCreateIndex IndexOrigin = "c" IndexOriginUniqueConstraint IndexOrigin = "u" )
Click to show internal directories.
Click to hide internal directories.