Documentation ¶
Index ¶
- Constants
- Variables
- func CreateDockerContainer(containerName, projectPath, imageName string) error
- func CreateDockerImage(dockerfileFileName string, imageName string) error
- func ExecuteCommand(command string, printStandardOutput bool, printErrorOutput bool) error
- func IsDockerInstalled() bool
- func IsNotPlural(str string) bool
- func KeyExist(key string, m map[string]string) bool
- func StartDockerContainer(containerName string) error
- func TrimNewPrefix(str string) string
- func TrimPluralization(str string) string
- func Upper(str string) string
- func WatchFiles(rootFolder string, includePatterns, excludePatterns []string, delay int, ...) error
- type AttributeWithTag
- type Base
- type ConfigurationAttribute
- type Controller
- type Controllers
- type Field
- type Folder
- type Generator
- func NewAbstractGenerator(name string, configSelectors []string, report Report, vectra *Vectra) *Generator
- func NewBase(cfg *Vectra) *Generator
- func NewControllers(cfg *Vectra) *Generator
- func NewI18n(cfg *Vectra) *Generator
- func NewServices(cfg *Vectra) *Generator
- func NewTypes(cfg *Vectra) *Generator
- type I18n
- type I18nConfig
- type I18nType
- type IGenerator
- type JsConfig
- type Method
- type NetworkConfig
- type PugConfig
- type Report
- type Route
- type SassConfig
- type Service
- type Services
- type SimpleAttribute
- type SourceFile
- type SpriteConfig
- type TemplateData
- type Types
- type Vectra
- func (v *Vectra) DeserializeFromMap(data map[string]any) error
- func (v *Vectra) FullGenerate()
- func (v *Vectra) FullReport()
- func (v *Vectra) Generate(key string)
- func (v *Vectra) GetFieldsAsMap(paths []string) map[string]any
- func (v *Vectra) Init()
- func (v *Vectra) Pack()
- func (v *Vectra) Report(key string)
- func (v *Vectra) Run()
- func (v *Vectra) Watch()
- type VectraType
- type ViewTypeConstructor
- type ViewTypes
- type Watcher
- type WatcherConfig
Constants ¶
const ( Same = 1 << iota Edited Deleted Info )
const ( Copy = 1 << iota // Default content could work as is and could be edited. CorePart // For the core of Vectra edit with caution. FullGen // Don't be edited at all. Skeleton // Stub content to be filled or edited later. )
Variables ¶
var ( //go:embed all:template EmbedFS embed.FS FolderProject = ".vectra" FolderReport = filepath.Join(FolderProject, "report") FolderTemplate = "template" )
Functions ¶
func CreateDockerContainer ¶
func CreateDockerImage ¶
func ExecuteCommand ¶
func IsDockerInstalled ¶
func IsDockerInstalled() bool
func IsNotPlural ¶
func StartDockerContainer ¶
func TrimNewPrefix ¶
func TrimPluralization ¶
func WatchFiles ¶
func WatchFiles(rootFolder string, includePatterns, excludePatterns []string, delay int, task func(string)) error
WatchFiles watches recursively a root folder for file changes and triggers a task when a file that matches the include patterns and does not match the exclude patterns is written.
Parameters:
- rootFolder: The root folder to watch for file changes.
- includePatterns: The patterns for files to include in the watch. Only files that match any of the include patterns are considered.
- excludePatterns: The patterns for files to exclude from the watch. Files that match any of the exclude patterns are ignored.
- delay: The delay in milliseconds before triggering the task after a file is written.
- task: The task to be executed when a file that matches the include patterns and does not match the exclude patterns is written.
Returns:
- error: An error if any occurred, otherwise nil.
Types ¶
type AttributeWithTag ¶
type AttributeWithTag struct { SimpleAttribute `yaml:",inline"` ModTag string `yaml:"mod"` ValidatorTag string `yaml:"validator"` }
type ConfigurationAttribute ¶ added in v1.1.0
type ConfigurationAttribute struct { SimpleAttribute `yaml:",inline"` IsTransient bool `yaml:"is_transient"` }
type Controller ¶
type Controllers ¶
type Controllers struct {
*Generator
}
func (*Controllers) Generate ¶
func (i *Controllers) Generate()
type Generator ¶
type Generator struct { IGenerator Name string // contains filtered or unexported fields }
func NewAbstractGenerator ¶
func NewControllers ¶
func NewServices ¶
func (*Generator) PrintReport ¶
func (g *Generator) PrintReport()
type I18nConfig ¶ added in v1.1.0
type I18nConfig struct {
Watcher `yaml:",inline"`
}
type IGenerator ¶
type IGenerator interface { Generate() PrintReport() }
type Method ¶
type Method struct { Name string `yaml:"name"` Inputs []SimpleAttribute `yaml:"inputs"` Outputs []string `yaml:"outputs"` }
type NetworkConfig ¶ added in v1.1.0
type Report ¶
type Report struct { Files []SourceFile `yaml:"files"` Config map[string]any `yaml:"config"` Version int8 `yaml:"version"` }
type SassConfig ¶ added in v1.1.0
type SassConfig struct {
Watcher `yaml:",inline"`
}
type Service ¶
type Service struct { Name string `yaml:"name"` Errors []string `yaml:"errors"` Methods []Method `yaml:"methods"` ExchangeTypes []VectraType[AttributeWithTag] `yaml:"exchange_types"` Bodies map[string]string `yaml:"-"` }
type SimpleAttribute ¶
type SourceFile ¶
type SourceFile struct { RealPath string `yaml:"path"` Hash string `yaml:"hash"` Kind int8 `yaml:"kind"` // contains filtered or unexported fields }
func NewDynSourceFile ¶
func NewDynSourceFile(path string, realpath string, kind int8) SourceFile
func NewSourceFile ¶
func NewSourceFile(path string, kind int8) SourceFile
type SpriteConfig ¶ added in v1.1.0
type TemplateData ¶
type Vectra ¶
type Vectra struct { ProjectPath string `yaml:"-"` WatcherConfig `yaml:"watcher_config"` SpriteConfig `yaml:"sprite_config"` NetConfProd NetworkConfig `yaml:"net_conf_prod"` NetConfDev NetworkConfig `yaml:"net_conf_dev"` ProjectName string `yaml:"project_name"` DefaultLang string `yaml:"default_lang"` WithGitignore bool `yaml:"with_gitignore"` WithDockerDeployment bool `yaml:"with_docker_deployment"` WithI18nExample bool `yaml:"with_i18n_example"` WithSassExample bool `yaml:"with_sass_example"` WithPugExample bool `yaml:"with_pug_example"` StorageTypes []VectraType[SimpleAttribute] `yaml:"storage_types"` ViewTypes `yaml:"view_types"` Controllers []Controller `yaml:"controllers"` Services []Service `yaml:"services"` Configuration []ConfigurationAttribute `yaml:"configuration"` // contains filtered or unexported fields }
func (*Vectra) FullGenerate ¶
func (v *Vectra) FullGenerate()
func (*Vectra) FullReport ¶
func (v *Vectra) FullReport()
type VectraType ¶
type ViewTypeConstructor ¶ added in v1.1.0
type ViewTypeConstructor struct { Name string `yaml:"name"` IsPageCtx bool `yaml:"is_page_ctx"` Attributes []SimpleAttribute `yaml:"attributes"` }
type ViewTypes ¶
type ViewTypes struct { Types []VectraType[SimpleAttribute] `yaml:"types"` Constructors []ViewTypeConstructor `yaml:"constructors"` Bodies map[string]string `yaml:"-"` }
type WatcherConfig ¶ added in v1.1.0
type WatcherConfig struct { PugConfig `yaml:"pug_config"` SassConfig `yaml:"sass_config"` JsConfig `yaml:"js_config"` I18nConfig `yaml:"i18n_config"` }