generate

package
v0.0.0-...-d364ca2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 17, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package generate implements Soro's deterministic application and component generators.

Index

Constants

View Source
const FrameworkModule = "github.com/ruby-dev/soro"

Variables

This section is empty.

Functions

func NewApplication

func NewApplication(options NewOptions) ([]string, error)

func ReadModule

func ReadModule(path string) (string, error)

func ValidateModule

func ValidateModule(module string) error

Types

type Field

type Field struct {
	Name       string
	GoName     string
	Type       FieldType
	Index      bool
	Unique     bool
	Nullable   bool
	Default    string
	HasDefault bool
}

func ParseField

func ParseField(specification string) (Field, error)

func ParseFields

func ParseFields(specifications []string) ([]Field, error)

func (Field) CreateGoType

func (field Field) CreateGoType() string

func (Field) GoDefault

func (field Field) GoDefault() string

func (Field) GoType

func (field Field) GoType() string

func (Field) SQLDefault

func (field Field) SQLDefault() (string, error)

func (Field) SQLType

func (field Field) SQLType() string

type FieldType

type FieldType string
const (
	String FieldType = "string"
	Text   FieldType = "text"
	Bool   FieldType = "bool"
	UUID   FieldType = "uuid"
	Int    FieldType = "int"
	Float  FieldType = "float"
	Time   FieldType = "time"
	JSON   FieldType = "json"
)

type Generator

type Generator struct {
	Root    string
	Module  string
	Force   bool
	Now     func() time.Time
	Version string
	// contains filtered or unexported fields
}

func Open

func Open(root string, force bool) (*Generator, error)

func (*Generator) GenerateJob

func (generator *Generator) GenerateJob(rawName string) ([]string, error)

func (*Generator) GenerateMailer

func (generator *Generator) GenerateMailer(rawName string) ([]string, error)

func (*Generator) GenerateMigration

func (generator *Generator) GenerateMigration(rawName string) ([]string, error)

func (*Generator) GenerateModel

func (generator *Generator) GenerateModel(rawName string, specifications []string) ([]string, error)

func (*Generator) GenerateResource

func (generator *Generator) GenerateResource(rawName string, specifications []string) ([]string, error)

func (*Generator) GenerateSerializer

func (generator *Generator) GenerateSerializer(rawName string, specifications []string) ([]string, error)

func (*Generator) GenerateValidator

func (generator *Generator) GenerateValidator(rawName string, specifications []string) ([]string, error)

func (*Generator) UseTransformers

func (generator *Generator) UseTransformers(transformers ...Transformer) error

type Name

type Name struct {
	Singular string
	Snake    string
	Plural   string
	Table    string
}

func ParseName

func ParseName(raw string) (Name, error)

type NewOptions

type NewOptions struct {
	ParentDirectory string
	Name            string
	Module          string
	SoroVersion     string
	SoroReplace     string
	Force           bool
}

type Transformer

type Transformer func(path string, content []byte) ([]byte, error)

Transformer customizes rendered file content without controlling its path or write behavior. Transformers run in registration order before final Go formatting and preflight checks.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL