Documentation ¶
Index ¶
- Variables
- func CopyField(child domain.DefField, parent *domain.DefField)
- func CreatePathToFieldMap(field *domain.DefField, mp map[string]*domain.DefField, keys *[]string)
- type ArticleService
- type CombineService
- type DecodeService
- type DefService
- func (s *DefService) LoadContentDef(content []byte) (ret domain.DefData)
- func (s *DefService) LoadDataContentDef(filesContents [][]byte, fieldsToExport *[]string) (ret domain.DefData)
- func (s *DefService) MergeDef(defaultDef domain.DefData, configDef domain.DefData, fieldsToExport *[]string) domain.DefData
- type ExcelChangedResult
- type ExcelService
- func (s *ExcelService) ConvertSingleExcelToSQLiteIfNeeded(dbName string, path string) (firstSheet string)
- func (s *ExcelService) ConvertWordExcelsToSQLiteIfNeeded(tableName string, dir string)
- func (s *ExcelService) ReadDataFromSQLite(field domain.DefField, dbName string, tableName string, total int, ...) ([]string, string)
- type ExpressionService
- type FieldService
- func (s *FieldService) CreateField(field *domain.DefField)
- func (s *FieldService) GenValuesForConfig(field *domain.DefField) (values []interface{})
- func (s *FieldService) GenValuesForMultiRes(field *domain.DefField, withFix bool)
- func (s *FieldService) GenValuesForSingleRes(field *domain.DefField)
- func (s *FieldService) Generate(field *domain.DefField, parentJoin bool)
- func (s *FieldService) GenerateValuesForNoReferField(field *domain.DefField)
- type FileService
- func (s *FileService) ComputerReferFilePath(file string, field *domain.DefField) (resPath string)
- func (s *FileService) GetFilesFromParams(args []string) (files []string, count int)
- func (s *FileService) HandleFileBuffers(files [][]byte) [][]byte
- func (s *FileService) HandleFiles(files []string) []string
- func (s *FileService) LoadFilesContents(files []string) (contents [][]byte)
- type FixService
- type FormatService
- type ListService
- func (s *ListService) AppendArrItems(items *[]interface{}, arr []string, total int, isRand bool) int
- func (s *ListService) AppendValues(items *[]interface{}, val string, repeat int, total int) int
- func (s *ListService) CreateListField(field *domain.DefField)
- func (s *ListService) CreateListFieldValues(field *domain.DefField)
- type LoopService
- type MainService
- func (s *MainService) GenerateDataByContents(contents [][]byte) (count int, err error)
- func (s *MainService) GenerateDataByFile(files []string) (count int, err error)
- func (s *MainService) GenerateFromContents(files []string)
- func (s *MainService) GenerateFromProtobuf(files []string)
- func (s *MainService) PrintOutput()
- type MockService
- type OutputService
- func (s *OutputService) FindValuesByPath(path string, defFields domain.DefField) []interface{}
- func (s *OutputService) GenExcel()
- func (s *OutputService) GenJson()
- func (s *OutputService) GenRecordField(field *domain.DefField, mp *map[string]interface{}, i int)
- func (s *OutputService) GenRecords() (records []map[string]interface{})
- func (s *OutputService) GenSql()
- func (s *OutputService) GenText(returnedForYamlRefer bool) (lines []interface{})
- func (s *OutputService) GenXml()
- func (s *OutputService) PrintHumanHeaderIfNeeded()
- func (s *OutputService) PrintJsonFooter()
- func (s *OutputService) PrintJsonHeader()
- func (s *OutputService) PrintXmlFooter()
- func (s *OutputService) PrintXmlHeader()
- type ParamService
- type PlaceholderService
- func (s *PlaceholderService) GetRandFieldSectionKey(pth string) (key int)
- func (s *PlaceholderService) PlaceholderMapForRandValues(tp string, list []string, start, end, step, precision, format string, ...) map[string]interface{}
- func (s *PlaceholderService) PlaceholderStr(key int) string
- func (s *PlaceholderService) ReplacePlaceholder(val string) (ret interface{})
- type PrintService
- type ProtobufService
- type RandomService
- func (s *RandomService) RandomInterfaces(values []interface{}) (ret []interface{})
- func (s *RandomService) RandomStrValues(values []string) (ret []string)
- func (s *RandomService) RandomValues(values []interface{}) (ret []interface{})
- func (s *RandomService) RandomValuesArr(values [][]interface{}) (ret [][]interface{})
- type RangeService
- func (s *RangeService) CheckRangeType(startStr string, endStr string, stepStr string) (dataType string, step interface{}, precision int, rand bool, count int)
- func (s *RangeService) CreateAffixValuesFromRange(strRang string, field *domain.DefField) (rang *domain.Range)
- func (s *RangeService) CreateFieldValuesFromRange(field *domain.DefField)
- func (s *RangeService) CreateValuesFromInterval(field *domain.DefField, desc, stepStr string, repeat int, repeatTag string) (items []interface{})
- func (s *RangeService) CreateValuesFromLiteral(field *domain.DefField, desc string, stepStr string, repeat int, ...) (items []interface{})
- func (s *RangeService) CreateValuesFromYaml(field *domain.DefField, yamlFile, stepStr string, repeat int, repeatTag string) (items []interface{})
- func (s *RangeService) DealwithFixRange(field *domain.DefField)
- func (s *RangeService) FixIsARange(fix string) bool
- func (s *RangeService) GetRandFieldSection(pth string) (key int)
- func (s *RangeService) ParseDesc(desc string) (items []string)
- func (s *RangeService) ParseRangeProperty(rang string) []string
- func (s *RangeService) ParseRangeSection(rang string) (entry string, step string, repeat int, repeatTag string)
- func (s *RangeService) ParseRangeSectionDesc(str string) (typ string, desc string)
- func (s *RangeService) ParseRepeat(rang string) (repeat int, repeatTag, rangeWithoutRepeat string)
- type ResConfigService
- type ResExcelService
- type ResInstancesService
- type ResRangesService
- type ResService
- func (s *ResService) GetFromKey(field *domain.DefField) string
- func (s *ResService) GetReferencedRangeOrInstant(inst domain.DefField) (referencedRanges domain.ResRanges, referencedInsts domain.ResInstances)
- func (s *ResService) GetResValueFromExcelOrYaml(resFile, resType, sheet string, field *domain.DefField) (map[string][]interface{}, string)
- func (s *ResService) LoadResDef(fieldsToExport []string) (res map[string]map[string][]interface{})
- type ResYamlService
- type SqlParseService
- type TableInfo
- type TableParseService
- type TextService
- type ValueService
Constants ¶
This section is empty.
Variables ¶
View Source
var ( MaxLen = 10 IgnoreWords = []string{"了", "的"} IgnoreCategories = []string{"姓", "名字", "介词"} )
Functions ¶
Types ¶
type ArticleService ¶
type ArticleService struct {
ResService *ResService `inject:""`
}
func (*ArticleService) CreateArticleField ¶
func (s *ArticleService) CreateArticleField(field *domain.DefField)
func (*ArticleService) GenArticle ¶
func (s *ArticleService) GenArticle(lines []interface{})
func (*ArticleService) GenYamlFromArticle ¶
func (s *ArticleService) GenYamlFromArticle(file string)
func (*ArticleService) LoadAllWords ¶
func (s *ArticleService) LoadAllWords() (ret map[string]string)
type CombineService ¶
type CombineService struct { ExcelService *ExcelService `inject:""` ExpressionService *ExpressionService `inject:""` LoopService *LoopService `inject:""` OutputService *OutputService `inject:""` PlaceholderService *PlaceholderService `inject:""` }
func (*CombineService) CombineChildrenIfNeeded ¶
func (s *CombineService) CombineChildrenIfNeeded(field *domain.DefField, isOnTopLevel bool)
func (*CombineService) ConnectValues ¶
func (s *CombineService) ConnectValues(values []interface{}) (ret string)
type DecodeService ¶
type DecodeService struct { DefService *DefService `inject:""` FileService *FileService `inject:""` ResService *ResService `inject:""` }
type DefService ¶
type DefService struct { ResService *ResService `inject:""` FieldService *FieldService `inject:""` CombineService *CombineService `inject:""` OutputService *OutputService `inject:""` ProtobufService *ProtobufService `inject:""` FileService *FileService `inject:""` }
func (*DefService) LoadContentDef ¶
func (s *DefService) LoadContentDef(content []byte) (ret domain.DefData)
func (*DefService) LoadDataContentDef ¶
func (s *DefService) LoadDataContentDef(filesContents [][]byte, fieldsToExport *[]string) (ret domain.DefData)
type ExcelChangedResult ¶
type ExcelService ¶
type ExcelService struct {
ExpressionService *ExpressionService `inject:""`
}
func (*ExcelService) ConvertSingleExcelToSQLiteIfNeeded ¶
func (s *ExcelService) ConvertSingleExcelToSQLiteIfNeeded(dbName string, path string) (firstSheet string)
func (*ExcelService) ConvertWordExcelsToSQLiteIfNeeded ¶
func (s *ExcelService) ConvertWordExcelsToSQLiteIfNeeded(tableName string, dir string)
type ExpressionService ¶
type ExpressionService struct { }
func (*ExpressionService) GenExpressionValues ¶
func (s *ExpressionService) GenExpressionValues(field domain.DefField) (ret []interface{})
func (*ExpressionService) ReplaceVariableValues ¶
func (s *ExpressionService) ReplaceVariableValues(exp string, valuesMap map[string][]interface{}) (ret []string)
type FieldService ¶
type FieldService struct { ResService *ResService `inject:""` TextService *TextService `inject:""` ValueService *ValueService `inject:""` ArticleService *ArticleService `inject:""` FixService *FixService `inject:""` LoopService *LoopService `inject:""` ListService *ListService `inject:""` RangeService *RangeService `inject:""` RandomService *RandomService `inject:""` CombineService *CombineService `inject:""` }
func (*FieldService) CreateField ¶
func (s *FieldService) CreateField(field *domain.DefField)
func (*FieldService) GenValuesForConfig ¶
func (s *FieldService) GenValuesForConfig(field *domain.DefField) (values []interface{})
func (*FieldService) GenValuesForMultiRes ¶
func (s *FieldService) GenValuesForMultiRes(field *domain.DefField, withFix bool)
func (*FieldService) GenValuesForSingleRes ¶
func (s *FieldService) GenValuesForSingleRes(field *domain.DefField)
func (*FieldService) Generate ¶
func (s *FieldService) Generate(field *domain.DefField, parentJoin bool)
func (*FieldService) GenerateValuesForNoReferField ¶
func (s *FieldService) GenerateValuesForNoReferField(field *domain.DefField)
type FileService ¶
type FileService struct { }
func (*FileService) ComputerReferFilePath ¶
func (s *FileService) ComputerReferFilePath(file string, field *domain.DefField) (resPath string)
func (*FileService) GetFilesFromParams ¶
func (s *FileService) GetFilesFromParams(args []string) (files []string, count int)
func (*FileService) HandleFileBuffers ¶
func (s *FileService) HandleFileBuffers(files [][]byte) [][]byte
func (*FileService) HandleFiles ¶
func (s *FileService) HandleFiles(files []string) []string
func (*FileService) LoadFilesContents ¶
func (s *FileService) LoadFilesContents(files []string) (contents [][]byte)
type FixService ¶
type FixService struct { }
func (*FixService) AddFix ¶
func (s *FixService) AddFix(val interface{}, field *domain.DefField, count int, withFix bool) (ret interface{})
func (*FixService) TrimIfFormatIsNotText ¶
func (s *FixService) TrimIfFormatIsNotText(str string) (ret string)
type FormatService ¶
type FormatService struct { }
func (*FormatService) GetFieldValStr ¶
func (s *FormatService) GetFieldValStr(field domain.DefField, val interface{}) interface{}
type ListService ¶
type ListService struct { TextService *TextService `inject:""` RangeService *RangeService `inject:""` }
func (*ListService) AppendArrItems ¶
func (s *ListService) AppendArrItems(items *[]interface{}, arr []string, total int, isRand bool) int
func (*ListService) AppendValues ¶
func (s *ListService) AppendValues(items *[]interface{}, val string, repeat int, total int) int
func (*ListService) CreateListField ¶
func (s *ListService) CreateListField(field *domain.DefField)
func (*ListService) CreateListFieldValues ¶
func (s *ListService) CreateListFieldValues(field *domain.DefField)
type LoopService ¶
type LoopService struct { FixService *FixService `inject:""` FormatService *FormatService `inject:""` }
func (*LoopService) ComputerLoopTimes ¶
func (s *LoopService) ComputerLoopTimes(field *domain.DefField)
func (*LoopService) LoopAndFixFieldValues ¶
func (s *LoopService) LoopAndFixFieldValues(field *domain.DefField, withFix bool)
func (*LoopService) LoopFieldValueToSingleStr ¶
type MainService ¶
type MainService struct { ResService *ResService `inject:""` FieldService *FieldService `inject:""` CombineService *CombineService `inject:""` OutputService *OutputService `inject:""` ProtobufService *ProtobufService `inject:""` FileService *FileService `inject:""` DefService *DefService `inject:""` ParamService *ParamService `inject:""` }
func (*MainService) GenerateDataByContents ¶
func (s *MainService) GenerateDataByContents(contents [][]byte) (count int, err error)
func (*MainService) GenerateDataByFile ¶
func (s *MainService) GenerateDataByFile(files []string) (count int, err error)
func (*MainService) GenerateFromContents ¶
func (s *MainService) GenerateFromContents(files []string)
func (*MainService) GenerateFromProtobuf ¶
func (s *MainService) GenerateFromProtobuf(files []string)
func (*MainService) PrintOutput ¶
func (s *MainService) PrintOutput()
type MockService ¶
type MockService struct {
FileService *FileService `inject:""`
}
func (*MockService) GenMockDef ¶
func (s *MockService) GenMockDef(input string) ( name, mockDefPath, zendataDefPath string, err error)
type OutputService ¶
type OutputService struct { CombineService *CombineService `inject:""` PlaceholderService *PlaceholderService `inject:""` PrintService *PrintService `inject:""` ExpressionService *ExpressionService `inject:""` }
func (*OutputService) FindValuesByPath ¶
func (s *OutputService) FindValuesByPath(path string, defFields domain.DefField) []interface{}
func (*OutputService) GenExcel ¶
func (s *OutputService) GenExcel()
func (*OutputService) GenJson ¶
func (s *OutputService) GenJson()
func (*OutputService) GenRecordField ¶
func (s *OutputService) GenRecordField(field *domain.DefField, mp *map[string]interface{}, i int)
func (*OutputService) GenRecords ¶
func (s *OutputService) GenRecords() (records []map[string]interface{})
func (*OutputService) GenSql ¶
func (s *OutputService) GenSql()
func (*OutputService) GenText ¶
func (s *OutputService) GenText(returnedForYamlRefer bool) (lines []interface{})
func (*OutputService) GenXml ¶
func (s *OutputService) GenXml()
func (*OutputService) PrintHumanHeaderIfNeeded ¶
func (s *OutputService) PrintHumanHeaderIfNeeded()
func (*OutputService) PrintJsonFooter ¶
func (s *OutputService) PrintJsonFooter()
func (*OutputService) PrintJsonHeader ¶
func (s *OutputService) PrintJsonHeader()
func (*OutputService) PrintXmlFooter ¶
func (s *OutputService) PrintXmlFooter()
func (*OutputService) PrintXmlHeader ¶
func (s *OutputService) PrintXmlHeader()
type ParamService ¶
type ParamService struct { }
func (*ParamService) CheckParams ¶
func (s *ParamService) CheckParams() (err error)
func (*ParamService) FixTotalNum ¶
func (s *ParamService) FixTotalNum()
type PlaceholderService ¶
type PlaceholderService struct {
FixService *FixService `inject:""`
}
func (*PlaceholderService) GetRandFieldSectionKey ¶
func (s *PlaceholderService) GetRandFieldSectionKey(pth string) (key int)
func (*PlaceholderService) PlaceholderMapForRandValues ¶
func (*PlaceholderService) PlaceholderStr ¶
func (s *PlaceholderService) PlaceholderStr(key int) string
func (*PlaceholderService) ReplacePlaceholder ¶
func (s *PlaceholderService) ReplacePlaceholder(val string) (ret interface{})
type PrintService ¶
type PrintService struct {
PlaceholderService *PlaceholderService `inject:""`
}
func (*PrintService) PrintLines ¶
func (s *PrintService) PrintLines() (lines []interface{})
func (*PrintService) PrintTextHeader ¶
func (s *PrintService) PrintTextHeader()
type ProtobufService ¶
type ProtobufService struct { ResService *ResService `inject:""` FieldService *FieldService `inject:""` CombineService *CombineService `inject:""` OutputService *OutputService `inject:""` }
func (*ProtobufService) GenerateProtobuf ¶
func (s *ProtobufService) GenerateProtobuf(protoFile string) (content, pth string)
type RandomService ¶
type RandomService struct { }
func (*RandomService) RandomInterfaces ¶
func (s *RandomService) RandomInterfaces(values []interface{}) (ret []interface{})
func (*RandomService) RandomStrValues ¶
func (s *RandomService) RandomStrValues(values []string) (ret []string)
func (*RandomService) RandomValues ¶
func (s *RandomService) RandomValues(values []interface{}) (ret []interface{})
func (*RandomService) RandomValuesArr ¶
func (s *RandomService) RandomValuesArr(values [][]interface{}) (ret [][]interface{})
type RangeService ¶
type RangeService struct { PlaceholderService *PlaceholderService `inject:""` ListService *ListService `inject:""` RandomService *RandomService `inject:""` DefService *DefService `inject:""` PrintService *PrintService `inject:""` CombineService *CombineService `inject:""` OutputService *OutputService `inject:""` FileService *FileService `inject:""` RangeService *RangeService `inject:""` MainService *MainService `inject:""` }
func (*RangeService) CheckRangeType ¶
func (*RangeService) CreateAffixValuesFromRange ¶
func (*RangeService) CreateFieldValuesFromRange ¶
func (s *RangeService) CreateFieldValuesFromRange(field *domain.DefField)
func (*RangeService) CreateValuesFromInterval ¶
func (*RangeService) CreateValuesFromLiteral ¶
func (*RangeService) CreateValuesFromYaml ¶
func (*RangeService) DealwithFixRange ¶
func (s *RangeService) DealwithFixRange(field *domain.DefField)
func (*RangeService) FixIsARange ¶
func (s *RangeService) FixIsARange(fix string) bool
func (*RangeService) GetRandFieldSection ¶
func (s *RangeService) GetRandFieldSection(pth string) (key int)
func (*RangeService) ParseDesc ¶
func (s *RangeService) ParseDesc(desc string) (items []string)
for Literal only
func (*RangeService) ParseRangeProperty ¶
func (s *RangeService) ParseRangeProperty(rang string) []string
func (*RangeService) ParseRangeSection ¶
func (s *RangeService) ParseRangeSection(rang string) (entry string, step string, repeat int, repeatTag string)
*
convert range item to entity, step, repeat [user1,user2]{2} -> entry =>[user1,user2] step =>1 repeat =>2
func (*RangeService) ParseRangeSectionDesc ¶
func (s *RangeService) ParseRangeSectionDesc(str string) (typ string, desc string)
*
get range item entity's type and desc 1-9 or [1-9] -> type => interval desc => 1-9 or [1-9] [user1,user2] -> type => literal desc => user2,user3
func (*RangeService) ParseRepeat ¶
func (s *RangeService) ParseRepeat(rang string) (repeat int, repeatTag, rangeWithoutRepeat string)
type ResConfigService ¶
type ResConfigService struct { FieldService *FieldService `inject:""` ExcelService *ExcelService `inject:""` RangeService *RangeService `inject:""` }
func (*ResConfigService) GetResForConfig ¶
func (s *ResConfigService) GetResForConfig(configRes domain.DefField) (groupedValue map[string][]interface{})
type ResExcelService ¶
type ResExcelService struct {
ExcelService *ExcelService `inject:""`
}
func (*ResExcelService) GetResFromExcel ¶
func (s *ResExcelService) GetResFromExcel(resFile, sheet string, field *domain.DefField) map[string][]interface{}
type ResInstancesService ¶
type ResInstancesService struct { ResService *ResService `inject:""` FieldService *FieldService `inject:""` CombineService *CombineService `inject:""` ResRangesService *ResRangesService `inject:""` ResInstancesService *ResInstancesService `inject:""` }
func (*ResInstancesService) ConvertInstantsToField ¶
func (s *ResInstancesService) ConvertInstantsToField(insts domain.ResInstances, inst domain.ResInstancesItem) (field domain.DefField)
func (*ResInstancesService) GetResFromInstances ¶
func (s *ResInstancesService) GetResFromInstances(insts domain.ResInstances) (groupedValue map[string][]interface{})
type ResRangesService ¶
type ResRangesService struct { ResService *ResService `inject:""` FieldService *FieldService `inject:""` }
func (*ResRangesService) ConvertRangesToField ¶
func (*ResRangesService) GetResFromRanges ¶
func (s *ResRangesService) GetResFromRanges(ranges domain.ResRanges) map[string][]interface{}
type ResService ¶
type ResService struct { FieldService *FieldService `inject:""` ResYamlService *ResYamlService `inject:""` ResExcelService *ResExcelService `inject:""` ResRangesService *ResRangesService `inject:""` ResInstancesService *ResInstancesService `inject:""` }
func (*ResService) GetFromKey ¶
func (s *ResService) GetFromKey(field *domain.DefField) string
func (*ResService) GetReferencedRangeOrInstant ¶
func (s *ResService) GetReferencedRangeOrInstant(inst domain.DefField) (referencedRanges domain.ResRanges, referencedInsts domain.ResInstances)
func (*ResService) GetResValueFromExcelOrYaml ¶
func (*ResService) LoadResDef ¶
func (s *ResService) LoadResDef(fieldsToExport []string) (res map[string]map[string][]interface{})
type ResYamlService ¶
type ResYamlService struct { ResConfigService *ResConfigService `inject:""` ResRangesService *ResRangesService `inject:""` ResInstancesService *ResInstancesService `inject:""` }
func (*ResYamlService) GetResFromYaml ¶
func (s *ResYamlService) GetResFromYaml(resFile string) (valueMap map[string][]interface{})
type SqlParseService ¶
type SqlParseService struct { }
func (*SqlParseService) GenYamlFromSql ¶
func (s *SqlParseService) GenYamlFromSql(file string)
type TableParseService ¶
type TableParseService struct {
SqlParseService *SqlParseService `inject:""`
}
func (*TableParseService) GenColArr ¶
func (s *TableParseService) GenColArr(records []map[string]interface{}) (ret map[string][]interface{})
func (*TableParseService) GenYamlFromTable ¶
func (s *TableParseService) GenYamlFromTable()
type TextService ¶
type TextService struct { RangeService *RangeService `inject:""` FileService *FileService `inject:""` }
func (*TextService) CreateFieldValuesFromText ¶
func (s *TextService) CreateFieldValuesFromText(field *domain.DefField)
type ValueService ¶
type ValueService struct { }
func (*ValueService) CreateTimestampField ¶
func (s *ValueService) CreateTimestampField(field *domain.DefField)
Source Files ¶
- article.go
- combine.go
- decode.go
- def.go
- excel.go
- expression.go
- field.go
- file.go
- fix.go
- format.go
- from-sql.go
- from-table.go
- list.go
- loop.go
- main.go
- mock.go
- output-comm.go
- output-excel.go
- output-json.go
- output-print.go
- output-sql.go
- output-text.go
- output-xml.go
- param.go
- placeholder.go
- protobuf.go
- random.go
- range.go
- res-config.go
- res-excel.go
- res-intances.go
- res-ranges.go
- res-yaml.go
- res.go
- text.go
- value.go
Click to show internal directories.
Click to hide internal directories.