generator

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateHandler

func GenerateHandler(s *Config, outputDir string)

func GenerateMain

func GenerateMain(parsedStruct *Config, modelnames []string, outputDir string)

func GenerateModel

func GenerateModel(s *Config, outputDir string) (string, []string)

func GenerateModelToResponse

func GenerateModelToResponse(s *Config, f *File)

func GenerateRequestResponse

func GenerateRequestResponse(s *Config, outputDir string)

func GenerateRequestStruct

func GenerateRequestStruct(s *Config, f *File)

func GenerateRequestToModel

func GenerateRequestToModel(s *Config, f *File)

func GenerateResponseStruct

func GenerateResponseStruct(s *Config, f *File)

func GormStruct

func GormStruct(s *Config, f *File) []string

func NameValaidation

func NameValaidation(input string) error

func ToSnakeCase

func ToSnakeCase(name string) string

Types

type Attribute

type Attribute struct {
	Name string `json:"name" yaml:"name"`

	Type       string      `json:"type" yaml:"type"`
	Attributes []Attribute `json:"attributes" yaml:"attributes"`
	IsRequired bool        `json:"is_required" yaml:"is_required"`
	// contains filtered or unexported fields
}

func AttributeCamelCase

func AttributeCamelCase(attr Attribute) Attribute

func (*Attribute) Validate

func (receiver *Attribute) Validate() error

type Config

type Config struct {
	Name string `json:"name" yaml:"name"`

	Attributes []Attribute `json:"attributes" yaml:"attributes"`
	// contains filtered or unexported fields
}

func InteractiveConfigGeneration

func InteractiveConfigGeneration(modelName string, skipName bool) (*Config, error)

func ParseStruct

func ParseStruct(s string) (*Config, error)

ParseStruct function accepts a string and tries to parse it into a Struct

func ParseStructFromFileName

func ParseStructFromFileName(fileName string) (*Config, error)

func (*Config) Generate

func (receiver *Config) Generate(outputDir string)

func (*Config) ToJSON

func (receiver *Config) ToJSON() (string, error)

func (*Config) ToYAML

func (receiver *Config) ToYAML() (string, error)

func (*Config) Validate

func (receiver *Config) Validate() error

Jump to

Keyboard shortcuts

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