Browse Source

添加ports的request和response

yjp 1 năm trước cách đây
mục cha
commit
744c4c9cd7

+ 0 - 11
ports/client_cmd_request.go

@@ -80,14 +80,3 @@ type TableModelField struct {
 	Name string `json:"name"`
 	Tag  string `json:"tag"`
 }
-
-type Key struct {
-	Column string `json:"column"`
-	Value  string `json:"value"`
-}
-
-type ColumnCompare struct {
-	Column  string `json:"column"`
-	Value   any    `json:"value"`
-	Compare string `json:"compare"`
-}

+ 68 - 0
ports/client_query_request.go

@@ -0,0 +1,68 @@
+package ports
+
+type QueryByWhereAndOrderByRequest struct {
+	DatabaseID            string
+	TablePrefixWithSchema string
+	Version               string
+	Select                string
+	Where                 []ColumnCompare
+	OrderBy               []string
+	PageNo                int32
+	PageSize              int32
+}
+
+type CommonQueryRequest struct {
+	DatabaseID            string
+	TablePrefixWithSchema string
+	Version               string
+	Select                string
+	Where                 []ColumnCompare
+	OrderBy               []string
+	Or                    []ColumnCompare
+	GroupBy               []string
+	Join                  string
+	Having                []ColumnCompare
+	PageNo                int32
+	PageSize              int32
+}
+
+type QueryByKeysRequest struct {
+	DatabaseID            string
+	TablePrefixWithSchema string
+	Version               string
+	Select                string
+	Keys                  []Key
+	Where                 []ColumnCompare
+}
+
+type CommonQueryByKeysRequest struct {
+	DatabaseID            string
+	TablePrefixWithSchema string
+	Version               string
+	Select                string
+	Keys                  []Key
+	Where                 []ColumnCompare
+	Or                    []ColumnCompare
+}
+
+type CountWhereRequest struct {
+	DatabaseID            string
+	TablePrefixWithSchema string
+	Version               string
+	Where                 []ColumnCompare
+	PageNo                int32
+	PageSize              int32
+}
+
+type CommonCountRequest struct {
+	DatabaseID            string
+	TablePrefixWithSchema string
+	Version               string
+	Where                 []ColumnCompare
+	Or                    []ColumnCompare
+	GroupBy               []string
+	Join                  string
+	Having                []ColumnCompare
+	PageNo                int32
+	PageSize              int32
+}

+ 33 - 0
ports/client_query_response.go

@@ -0,0 +1,33 @@
+package ports
+
+type QueryResponse struct {
+	Statement  string
+	Infos      []*InfoData
+	TotalCount int64
+	PageNo     int32
+}
+
+type QueryByKeysResponse struct {
+	Statement string
+	Info      *InfoData
+}
+
+type CountResponse struct {
+	Statement string
+	Count     int64
+}
+
+type InfoData struct {
+	Columns []*Column
+}
+
+type Column struct {
+	Name  string
+	Value *ColumnValue
+}
+
+type ColumnValue struct {
+	Kind  int32
+	Type  string
+	Value any
+}

+ 12 - 0
ports/client_request_common.go

@@ -0,0 +1,12 @@
+package ports
+
+type Key struct {
+	Column string `json:"column"`
+	Value  string `json:"value"`
+}
+
+type ColumnCompare struct {
+	Column  string `json:"column"`
+	Value   any    `json:"value"`
+	Compare string `json:"compare"`
+}