Documentation
¶
Index ¶
- Constants
- Variables
- func EnsureDir(root *os.Root, filePath string) error
- func HasPath(root *os.Root, filePath string) bool
- func MkDirAll(root *os.Root, dirPath string) error
- func Parse(rootFs *os.Root, defDir string) (*Definition, *Report, error)
- func Render(file *templates.File, data any) ([]byte, error)
- func WriteFile(root *os.Root, path string, data []byte) error
- type Alias
- type Definition
- type Diag
- type Field
- type FieldTag
- type FieldType
- type MetaKeyResult
- type Metadata
- type MetadataValueDesc
- type Method
- type Object
- type ParseStats
- type Project
- type Report
- type Service
Constants ¶
View Source
const ( GitIgnoreFile = ".gitignore" MainFile = "main.go" LocalFile = "local.json" GoModFile = "go.mod" ConfigFileProject = "atomika.json" )
View Source
const ( DefDirService = "def" ErrFile = "errors.go" DefinitionFile = "definitions.go" ConsumerFile = "consumer.go" ServerFile = "server.go" ServiceFile = "service.go" TestFile = "service_test.go" )
View Source
const ( ClientGoFile = "client.go" ClientJsFile = "client.js" ClientTsFile = "client.ts" )
Variables ¶
View Source
var ( ErrCwd = errors.New("cannot cwd") ErrCreateDir = errors.New("cannot create dir") ErrSetDirRoot = errors.New("cannot set dir root") ErrBadPath = errors.New("bad path") ErrLoadFromFile = errors.New("cannot load from file") )
View Source
var ( ErrPkgNotFound = errors.New("pkg not found") ErrPkgMod = errors.New("pkg has no module information") ErrNoGoFilesFound = errors.New("pkg has no Go files") ErrMethodFormat = errors.New("invalid method format. Expected: Method(MethodReq) MethodRes") ErrMethodObjParse = errors.New("cannot parse object for method") ErrObjNotStruct = errors.New("object is not a struct") ErrObjNotFound = errors.New("object not found") ErrFieldUnexported = errors.New("filed is unexported") ErrFieldIsStruct = errors.New("filed cannot not be struct") )
Parser errors
Functions ¶
Types ¶
type Definition ¶
type Definition struct {
Package string
Imports map[string]string
Aliases []*Alias
Services []*Service
Objects []*Object
}
Definition will map the contents of service/def dir to an interface
type MetaKeyResult ¶
type MetadataValueDesc ¶
type ParseStats ¶
type ParseStats struct {
PackageName string `json:"packageName"`
NumFiles int `json:"numFiles"`
NumServices int `json:"numServices"`
NumObjects int `json:"numObjects"`
NumMethods int `json:"numMethods"`
NumFields int `json:"numFields"`
StartedAt time.Time `json:"startedAt"`
FinishedAt time.Time `json:"finishedAt"`
}
ParseStats tracks deterministic counters for CI visibility.
func (ParseStats) TimeTook ¶
func (p ParseStats) TimeTook() string
type Project ¶
type Project struct {
ID string `json:"id"`
Name string `json:"name"`
Path string `json:"path"`
// contains filtered or unexported fields
}
func LoadFromConfig ¶
LoadFromConfig load a project from an atomika.json file
type Report ¶
type Report struct {
Warnings []Diag `json:"warnings"`
Errors []Diag `json:"errors"`
Stats ParseStats `json:"stats"`
}
Click to show internal directories.
Click to hide internal directories.