Documentation ¶
Index ¶
- Constants
- Variables
- func ApplyCommands(node *ast.File, config *GrizzlyConfigCollection) *ast.File
- func CheckExistDir(path string) bool
- func CheckExistFile(path string) bool
- func CreateCollection(modelName string, code string, isUpdate bool, savePath string) error
- func GenCode(config *GrizzlyConfigCollection, code []byte, isSimple bool) []byte
- func GenCollectionCode(config GrizzlyConfigCollection, isSimple bool) (result string, err error)
- func GetCollectionCode() (result []byte, err error)
- func GetCollectionDir(isDev bool) (string, error)
- func GetDefaultMethods() []string
- func GetGrizzlyCommand(doc *ast.CommentGroup) map[string]GrizzlyCommand
- func GetImportsByMethods(methods []string) (imports []string)
- func GetMethod(collectionDir string, method string) (result []byte, err error)
- func GetMethodsCode(methods []string, types []GrizzlyType) (result []byte, err error)
- func InjectImports(code []byte, imports []string) (result []byte)
- func InjectTypes(node *ast.File, config *GrizzlyConfigCollection)
- func IsPropertyMethod(method string) bool
- func RemovePackage(code []byte) []byte
- func RemoveType(node *ast.File, config *GrizzlyConfigCollection)
- func ReplaceGrizzlyId(code []byte, customType string) []byte
- func ReplaceImports(code []byte) []byte
- func ReplaceSearchCallback(code []byte, modelName string) []byte
- func SwapTypes(node *ast.File, config *GrizzlyConfigCollection)
- type GrizzlyCommand
- type GrizzlyConfig
- type GrizzlyConfigCollection
- type GrizzlyType
Constants ¶
View Source
const ( MethodFind = "find" MethodFilter = "filter" MethodMaps = "maps" MethodArray = "array" MethodGet = "get" MethodUniq = "uniq" MethodSort = "sort" MethodEach = "each" )
View Source
const ( GrizzlyCollection = "Collection" GrizzlyModel = "Model" CommandReplaceName = "grizzly:replaceName" CommandGenerate = "grizzly:generate" )
View Source
const GithubRepo = "github.com/matroskin13/grizzly"
Variables ¶
View Source
var PrimitiveTypes = []string{
"int",
"int8",
"int16",
"int32",
"int64",
"uint",
"uint8",
"uint16",
"uint32",
"uint64",
"uintptr",
"string",
"bool",
"float64",
"float32",
}
Functions ¶
func ApplyCommands ¶
func ApplyCommands(node *ast.File, config *GrizzlyConfigCollection) *ast.File
func CheckExistDir ¶
func CheckExistFile ¶
func CreateCollection ¶
func GenCollectionCode ¶
func GenCollectionCode(config GrizzlyConfigCollection, isSimple bool) (result string, err error)
func GetCollectionCode ¶
func GetCollectionDir ¶
func GetDefaultMethods ¶
func GetDefaultMethods() []string
func GetGrizzlyCommand ¶
func GetGrizzlyCommand(doc *ast.CommentGroup) map[string]GrizzlyCommand
Return grizzly commands by comments of code. Example:
//grizzly:replaceName GetGrizzly{{.Name}} func GetGrizzly() {}
func GetImportsByMethods ¶
func GetMethodsCode ¶
func GetMethodsCode(methods []string, types []GrizzlyType) (result []byte, err error)
func InjectImports ¶
func InjectTypes ¶
func InjectTypes(node *ast.File, config *GrizzlyConfigCollection)
func IsPropertyMethod ¶
func RemoveType ¶
func RemoveType(node *ast.File, config *GrizzlyConfigCollection)
func ReplaceGrizzlyId ¶
func ReplaceImports ¶
func ReplaceSearchCallback ¶
func SwapTypes ¶
func SwapTypes(node *ast.File, config *GrizzlyConfigCollection)
Replaces grizzly Model and Collection
Types ¶
type GrizzlyCommand ¶
type GrizzlyConfig ¶
type GrizzlyConfig struct {
Collections []GrizzlyConfigCollection `json:"collections"`
}
func GetConfigByCode ¶
func GetConfigByCode(code []byte) (*GrizzlyConfig, error)
Create config from GO code
type GrizzlyConfigCollection ¶
type GrizzlyType ¶
func GenerateTypes ¶
func GenerateTypes(configTypes map[string]string) []GrizzlyType
Click to show internal directories.
Click to hide internal directories.