generators

package
v0.0.0-...-b25cd16 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateProject

func GenerateProject(data ProjectData) error

Generate a project

Types

type Event

type Event struct {
	Name        string `yaml:"name"`
	Payload     string `yaml:"payload"`
	Description string `yaml:"description"`
}

type Field

type Field struct {
	Name     string `yaml:"name"`
	Type     string `yaml:"type"`
	JSONName string `yaml:"json_name"`
}

type Handler

type Handler struct {
	Name    string  `yaml:"name"`
	Service string  `yaml:"service"`
	Routes  []Route `yaml:"routes"`
}

type Model

type Model struct {
	Name   string  `yaml:"name"`
	Fields []Field `yaml:"fields"`
}

type Param

type Param struct {
	Name string `yaml:"name"`
	Type string `yaml:"type"`
}

type ProjectData

type ProjectData struct {
	ProjectName   string
	ProjectPath   string // e.g., "generated/github.com/Systenix/test"
	ModulePath    string // e.g., "github.com/Systenix/test"
	ProjectDir    string // Filesystem path
	Protocol      string
	MessageBroker string
	IncludeDocker bool
	Services      []Service
	Models        []Model
	Events        []Event
}

type Repository

type Repository struct {
	Name  string `yaml:"name"`
	Model string `yaml:"model"`
}

type Route

type Route struct {
	Path          string `yaml:"path"`
	Method        string `yaml:"method"`
	Function      string `yaml:"function"`
	ServiceMethod string `yaml:"service_method"`
	RequestModel  string `yaml:"request_model"`
	ResponseModel string `yaml:"response_model"`
}

type Service

type Service struct {
	Name         string          `yaml:"name"`
	Type         string          `yaml:"type"`
	Models       []Model         `yaml:"models"`
	ModelNames   []string        `yaml:"model_names"`
	Repositories []Repository    `yaml:"repositories"`
	Handlers     []Handler       `yaml:"handlers"`
	Methods      []ServiceMethod `yaml:"methods"`
}

type ServiceMethod

type ServiceMethod struct {
	Name    string  `yaml:"name"`
	Params  []Param `yaml:"params"`
	Returns []Param `yaml:"returns"`
}

Jump to

Keyboard shortcuts

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