Documentation
¶
Overview ¶
Example (GenerateWithSchema) ¶
package main
import (
"context"
"fmt"
"github.com/Jumpaku/schenerate/files"
"github.com/Jumpaku/schenerate/postgres"
)
func main() {
ctx := context.Background()
q, err := postgres.Open("postgres://<user>:<password>@<host>:<port>/<dbname>")
if err != nil {
panic(err)
}
defer q.Close()
err = postgres.GenerateWithSchema(ctx, q,
[]string{"Table"},
func(w *files.Writer, schemas postgres.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 {
Name string
Key []string
Reference ForeignKeyReference
}
type ForeignKeyReference ¶
type IndexKeyElem ¶
Click to show internal directories.
Click to hide internal directories.