Documentation ¶
Index ¶
- Constants
- Variables
- func FormatConfigCode(config *APIConfig) string
- func FormatMessage(message *MessageItem) string
- func FormatServiceCode(serviceItems []*ServiceItem, messageItems []*MessageItem, filename string) string
- func FuncCodeIndentation(funcCode string) string
- func GetIndentation(level int) []byte
- func SetIndentation(number int)
- type API
- type APIConfig
- type APIUtils
- type MessageField
- type MessageItem
- type ServiceItem
Constants ¶
View Source
const FunctionCode_ObjectToFormData = `` /* 869-byte string literal not displayed */
View Source
const MessageFileSuffix = ".go.ts"
View Source
const RequestMessageSuffix = "Req"
View Source
const ResponseMessageSuffix = "Res"
View Source
const ServiceFileSuffix = ".http.ts"
Variables ¶
View Source
var Copyright = []byte("// Generate File, Should not Edit.\n" + "// Author: mario. https://github.com/mats9693\n" + "// Version: " + Version + "\n")
View Source
var MessageFieldType = map[string]string{
"string": "string",
"int32": "number",
"bool": "boolean",
}
MessageFieldType go type - ts type
View Source
var MessageFieldZeroValue = map[string]string{
"string": `""`,
"number": `0`,
"boolean": `false`,
}
MessageFieldZeroValue ts type - zero value
View Source
var Version = "goc_ts v0.2.1"
Functions ¶
func FormatConfigCode ¶
func FormatMessage ¶
func FormatMessage(message *MessageItem) string
FormatMessage format 'message item' to ts code
func FormatServiceCode ¶
func FormatServiceCode(serviceItems []*ServiceItem, messageItems []*MessageItem, filename string) string
func FuncCodeIndentation ¶
func GetIndentation ¶
func SetIndentation ¶
func SetIndentation(number int)
Types ¶
type API ¶
type API struct { Config *APIConfig Utils *APIUtils Service map[string][]*ServiceItem // filename - service items Message map[string][]*MessageItem // filename - message items }
type MessageField ¶
type MessageItem ¶
type MessageItem struct { Name string Fields []*MessageField }
type ServiceItem ¶
Click to show internal directories.
Click to hide internal directories.