Documentation
¶
Overview ¶
Package scaffold generates Ohm application, handler, migration, resource, and replay-test files.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrUnsupportedDatabase = errors.New("unsupported database")
ErrUnsupportedDatabase reports an unknown generated database target.
Functions ¶
func GenerateApp ¶
GenerateApp writes a new Ohm application skeleton to cfg.Destination.
func GenerateMigration ¶
GenerateMigration writes a timestamped goose migration file and returns its path.
Types ¶
type App ¶
type App struct {
Name string
Module string
Destination string
Database Database
OhmVersion string
}
App describes a generated Ohm application.
type Database ¶
type Database string
Database identifies the generated application's database default.
type HandlerResult ¶
type HandlerResult struct {
CreatedFiles []string
RegisterFile string
RegisterUpdated bool
RoutePath string
}
HandlerResult describes the files changed by GenerateHandler.
func GenerateHandler ¶
func GenerateHandler(cfg Handler) (HandlerResult, error)
GenerateHandler writes a handler and wires its route into handlers.Register.
type ReplayTest ¶
ReplayTest describes a generated replay regression test.
type ReplayTestResult ¶
type ReplayTestResult struct {
CreatedFile string
}
ReplayTestResult describes the file created by GenerateReplayTest.
func GenerateReplayTest ¶
func GenerateReplayTest(cfg ReplayTest) (ReplayTestResult, error)
GenerateReplayTest writes a Go test that replays a snapshot through the app.
type Resource ¶
type Resource struct {
Name string
Fields []ResourceField
Dir string
Now func() time.Time
}
Resource describes generated files for an application resource.
type ResourceField ¶
ResourceField describes a generated resource database field.
type ResourceResult ¶
type ResourceResult struct {
CreatedFiles []string
RegisterFile string
RegisterUpdated bool
RoutePath string
}
ResourceResult describes the files changed by GenerateResource.
func GenerateResource ¶
func GenerateResource(cfg Resource) (ResourceResult, error)
GenerateResource writes a routed handler skeleton plus database migration and sqlc query files.