Documentation
¶
Overview ¶
Package project defines a tiny project structure
Index ¶
- func CreateConfig(service, endpoint, method, module, file string) error
- type BoolValue
- type Config
- type Endpoint
- type Enum
- type Field
- type IntValue
- type KeyValue
- type Message
- type Method
- type NumberValue
- type Option
- type Options
- type Project
- func (p *Project) Apply() error
- func (p *Project) Format() error
- func (p *Project) GenerateDockerfile() error
- func (p *Project) GenerateGitIgnore() error
- func (p *Project) GenerateGoMod() error
- func (p *Project) GenerateHandlers() error
- func (p *Project) GenerateServers() error
- func (p *Project) GenerateTaskfile() error
- func (p *Project) GenerateTypes() error
- func (p *Project) Init() error
- func (p *Project) Tidy() error
- type ProjectOption
- type Service
- func (s *Service) DirectoryName() string
- func (s *Service) GetAllConfigs() []*Config
- func (s *Service) GetAllEndpoints() []*Endpoint
- func (s *Service) GetAllEnums() []*Enum
- func (s *Service) GetAllMessages() []*Message
- func (s *Service) GetConfig(name string) (*Config, bool)
- func (s *Service) GetEndpoint(name string) (*Endpoint, bool)
- func (s *Service) GetEnum(name string) (*Enum, bool)
- func (s *Service) GetMessage(name string) (*Message, bool)
- type StringValue
- type Valuer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateConfig ¶
Types ¶
type Config ¶ added in v0.2.0
func (*Config) GetAllFields ¶ added in v0.2.0
func (*Config) GetFieldNames ¶ added in v0.2.0
func (*Config) GetFieldTypes ¶ added in v0.2.0
type Field ¶
func (*Field) DeclarationName ¶
func (*Field) DeclarationTag ¶
func (*Field) DeclarationType ¶
type Message ¶
func NewMessage ¶
func (*Message) GetAllFields ¶
func (*Message) GetFieldNames ¶
func (*Message) GetFieldTypes ¶
type NumberValue ¶
type NumberValue struct {
Value float64
}
func (*NumberValue) GetValue ¶
func (n *NumberValue) GetValue() interface{}
type Options ¶
Options is a map of option names to their values.
type Project ¶
Project represents a project with a mucl definition file in a dedicated directory.
func NewProject ¶
func NewProject(opts ...ProjectOption) (*Project, error)
NewProject creates a new Project instance with the given options. It initializes the project with default values and applies the provided options. It returns a pointer to the Project instance and an error if any occurs. The default mucl file is "service.mu" and the default output directory is ".". The project is not loaded at this point, so you need to call Init() separately.
func (*Project) GenerateDockerfile ¶ added in v0.3.0
func (*Project) GenerateGitIgnore ¶
func (*Project) GenerateGoMod ¶
func (*Project) GenerateHandlers ¶
func (*Project) GenerateServers ¶
func (*Project) GenerateTaskfile ¶
func (*Project) GenerateTypes ¶
type ProjectOption ¶
type ProjectOption func(*Project)
ProjectOption is a function that configures a Project. It is used to set various options for the project.
func WithForce ¶
func WithForce(force bool) ProjectOption
WithForce sets whether to forcefully overwrite existing files.
func WithMuclFile ¶
func WithMuclFile(muclFile string) ProjectOption
WithMuclFile sets the mucl file for the project.
func WithOnlyTypes ¶
func WithOnlyTypes(onlyTypes bool) ProjectOption
WithOnlyTypes sets whether to only generate types.
func WithOutputDir ¶
func WithOutputDir(outDir string) ProjectOption
WithOutputDir sets the output directory for the project. This is where the generated code will be placed.
type Service ¶
type Service struct {
Name string
Description string
EndpointMap map[string]*Endpoint
MessageMap map[string]*Message
EnumMap map[string]*Enum
ConfigMap map[string]*Config
}
func (*Service) DirectoryName ¶
func (*Service) GetAllConfigs ¶ added in v0.2.0
func (*Service) GetAllEndpoints ¶
func (*Service) GetAllEnums ¶
func (*Service) GetAllMessages ¶
type StringValue ¶
type StringValue struct {
Value string
}
func (*StringValue) GetValue ¶
func (s *StringValue) GetValue() interface{}