github.com/unionj-cloud/go-doudou/v2@v2.3.5/toolkit/astutils/testdata/vo.go (about) 1 package main 2 3 //go:generate go-doudou name --file $GOFILE -o 4 5 // 筛选条件 6 type PageFilter struct { 7 // 真实姓名,前缀匹配 8 Name string `json:"name,omitempty"` 9 // 所属部门ID 10 Dept int `json:"dept,omitempty"` 11 } 12 13 //排序条件 14 type Order struct { 15 Col string `json:"col,omitempty"` 16 Sort, Name, Banana string 17 } 18 19 // 分页筛选条件 20 type PageQuery struct { 21 Filter PageFilter `json:"filter,omitempty"` 22 Page Page `json:"page,omitempty"` 23 } 24 25 type PageRet struct { 26 Items interface{} `json:"items,omitempty"` 27 PageNo int `json:"pageNo,omitempty"` 28 PageSize int `json:"pageSize,omitempty"` 29 Total int `json:"total,omitempty"` 30 HasNext bool `json:"hasNext,omitempty"` 31 } 32 33 type queryType int 34 type queryLogic int 35 36 const ( 37 SHOULD queryLogic = iota + 1 38 MUST 39 MUSTNOT 40 ) 41 42 const ( 43 TERMS queryType = iota + 1 44 MATCHPHRASE 45 RANGE 46 PREFIX 47 WILDCARD 48 EXISTS 49 ) 50 51 type esFieldType string 52 53 const ( 54 TEXT esFieldType = "text" 55 KEYWORD esFieldType = "keyword" 56 DATE esFieldType = "date" 57 LONG esFieldType = "long" 58 INTEGER esFieldType = "integer" 59 SHORT esFieldType = "short" 60 DOUBLE esFieldType = "double" 61 FLOAT esFieldType = "float" 62 BOOL esFieldType = "boolean" 63 ) 64 65 type Base struct { 66 Index string `json:"index,omitempty"` 67 Type string `json:"type,omitempty"` 68 } 69 70 type QueryCond struct { 71 Pair map[string][]interface{} `json:"pair,omitempty"` 72 QueryLogic queryLogic `json:"queryLogic,omitempty"` 73 QueryType queryType `json:"queryType,omitempty"` 74 Children []QueryCond `json:"children,omitempty"` 75 } 76 77 type Sort struct { 78 Field string `json:"field,omitempty"` 79 Ascending bool `json:"ascending,omitempty"` 80 } 81 82 type Paging struct { 83 StartDate string `json:"startDate,omitempty"` 84 EndDate string `json:"endDate,omitempty"` 85 DateField string `json:"dateField,omitempty"` 86 QueryConds []QueryCond `json:"queryConds,omitempty"` 87 Skip int `json:"skip,omitempty"` 88 Limit int `json:"limit,omitempty"` 89 Sortby []Sort `json:"sortby,omitempty"` 90 } 91 92 type BulkSavePayload struct { 93 Base 94 Docs []map[string]interface{} `json:"docs,omitempty"` 95 } 96 97 type SavePayload struct { 98 Base 99 Doc map[string]interface{} `json:"doc,omitempty"` 100 } 101 102 type BulkDeletePayload struct { 103 Base 104 DocIds []string `json:"docIds,omitempty"` 105 } 106 107 type PagePayload struct { 108 Base 109 Paging 110 } 111 112 type PageResult struct { 113 Page int `json:"page,omitempty"` 114 PageSize int `json:"pageSize,omitempty"` 115 Total int `json:"total,omitempty"` 116 Docs []map[string]interface{} `json:"docs,omitempty"` 117 HasNextPage bool `json:"hasNextPage,omitempty"` 118 } 119 120 type StatPayload struct { 121 Base 122 Paging 123 Aggr interface{} `json:"aggr,omitempty"` 124 } 125 126 type RandomPayload struct { 127 Base 128 Paging 129 } 130 131 type CountPayload struct { 132 Base 133 Paging 134 } 135 136 type Field struct { 137 Name string `json:"name,omitempty"` 138 Type esFieldType `json:"type,omitempty"` 139 Format string `json:"format,omitempty"` 140 } 141 142 type MappingPayload struct { 143 Base 144 Fields []Field `json:"fields,omitempty"` 145 }