Documentation
¶
Overview ¶
package generation provides the ability to generate resource, handler, and typescript permissions and metadata code from a resource file.
Index ¶
- Constants
- func CaserInitialismOverrides(overrides map[string]bool) option
- func WithConsolidatedHandlers(route string, consolidateAll bool, resources ...string) option
- func WithPluralOverrides(overrides map[string]string) option
- func WithRPC(rpcPackageDir string, businessPackageDir string) option
- type ConstraintType
- type GeneratedFileDeleteMethod
- type Generator
- type HandlerType
- type InformationSchemaResult
- type Option
- type OptionType
- type PatchType
- type ResourceOption
- type TSGenMode
- type TSOption
Constants ¶
View Source
const ( // Adds permission.ts to generator output TSPerm tsGenMode = 1 << iota // Adds resource.ts to generator output TSMeta )
Variables ¶
This section is empty.
Functions ¶
func CaserInitialismOverrides ¶ added in v0.0.10
func WithConsolidatedHandlers ¶ added in v0.0.13
func WithPluralOverrides ¶ added in v0.0.10
Types ¶
type ConstraintType ¶
type ConstraintType string
const ( PrimaryKey ConstraintType = "PRIMARY KEY" ForeignKey ConstraintType = "FOREIGN KEY" )
type GeneratedFileDeleteMethod ¶ added in v0.0.9
type GeneratedFileDeleteMethod int
const ( // Used to remove files with the genPrefix value instead of reading the contents of the file. Prefix GeneratedFileDeleteMethod = iota // Used to remove files that contain the header comment "// Code generated by resourcegeneration. DO NOT EDIT." HeaderComment )
type Generator ¶ added in v0.0.16
type Generator interface {
Generate() error
Close()
}
func NewResourceGenerator ¶ added in v0.0.14
type HandlerType ¶
type HandlerType string
const ( All HandlerType = "all" List HandlerType = "list" Read HandlerType = "read" Patch HandlerType = "patch" )
func (HandlerType) Method ¶ added in v0.0.13
func (h HandlerType) Method() string
type InformationSchemaResult ¶
type InformationSchemaResult struct {
TableName string `spanner:"TABLE_NAME"`
ColumnName string `spanner:"COLUMN_NAME"`
ConstraintName *string `spanner:"CONSTRAINT_NAME"`
IsPrimaryKey bool `spanner:"IS_PRIMARY_KEY"`
IsForeignKey bool `spanner:"IS_FOREIGN_KEY"`
ReferencedTable *string `spanner:"REFERENCED_TABLE"`
ReferencedColumn *string `spanner:"REFERENCED_COLUMN"`
SpannerType string `spanner:"SPANNER_TYPE"`
IsNullable bool `spanner:"IS_NULLABLE"`
IsView bool `spanner:"IS_VIEW"`
IsIndex bool `spanner:"IS_INDEX"`
IsUniqueIndex bool `spanner:"IS_UNIQUE_INDEX"`
GenerationExpression *string `spanner:"GENERATION_EXPRESSION"`
OrdinalPosition int64 `spanner:"ORDINAL_POSITION"`
KeyOrdinalPosition int64 `spanner:"KEY_ORDINAL_POSITION"`
HasDefault bool `spanner:"HAS_DEFAULT"`
}
type OptionType ¶
type OptionType string
const ( Regenerate OptionType = "regenerate" NoGenerate OptionType = "nogenerate" )
type ResourceOption ¶ added in v0.0.14
type ResourceOption interface {
Option
// contains filtered or unexported methods
}
func GenerateHandlers ¶ added in v0.0.10
func GenerateHandlers(targetDir string, ignoredHandlers map[string][]HandlerType) ResourceOption
ignoredHandlers maps the name of a resource and to handler types (list, read, patch) that you do not want generated for that resource
func GenerateRoutes ¶ added in v0.0.13
func GenerateRoutes(targetDir, targetPackage, routePrefix string) ResourceOption
Source Files
¶
Click to show internal directories.
Click to hide internal directories.