forked from snowflakedb/gosnowflake
-
Notifications
You must be signed in to change notification settings - Fork 0
/
query.go
70 lines (62 loc) · 2.85 KB
/
query.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// Copyright (c) 2017-2018 Snowflake Computing Inc. All right reserved.
package gosnowflake
import (
"time"
)
type execBindParameter struct {
Type string `json:"type"`
Value *string `json:"value"`
}
type execRequest struct {
SQLText string `json:"sqlText"`
AsyncExec bool `json:"asyncExec"`
SequenceID uint64 `json:"sequenceId"`
IsInternal bool `json:"isInternal"`
Parameters map[string]string `json:"parameters,omitempty"`
Bindings map[string]execBindParameter `json:"bindings,omitempty"`
}
type execResponseRowType struct {
Name string `json:"name"`
ByteLength int64 `json:"byteLength"`
Length int64 `json:"length"`
Type string `json:"type"`
Scale int64 `json:"scale"`
Precision int64 `json:"precision"`
Nullable bool `json:"nullable"`
}
type execResponseChunk struct {
URL string `json:"url"`
RowCount int `json:"rowCount"`
}
// make all data field optional
type execResponseData struct {
// succeed query response data
Parameters []nameValueParameter `json:"parameters,omitempty"`
RowType []execResponseRowType `json:"rowtype,omitempty"`
RowSet [][]*string `json:"rowset,omitempty"`
Total int64 `json:"total,omitempty"` // java:long
Returned int64 `json:"returned,omitempty"` // java:long
QueryID string `json:"queryId,omitempty"`
SQLState string `json:"sqlState,omitempty"`
DatabaseProvider string `json:"databaseProvider,omitempty"`
FinalDatabaseName string `json:"finalDatabaseName,omitempty"`
FinalSchemaName string `json:"finalSchemaName,omitempty"`
FinalWarehouseName string `json:"finalWarehouseName,omitempty"`
FinalRoleName string `json:"finalRoleName,omitempty"`
NumberOfBinds int `json:"numberOfBinds,omitempty"` // java:int
StatementTypeID int64 `json:"statementTypeId,omitempty"` // java:long
Version int64 `json:"version,omitempty"` // java:long
Chunks []execResponseChunk `json:"chunks,omitempty"`
Qrmk string `json:"qrmk,omitempty"`
ChunkHeaders map[string]string `json:"chunkHeaders,omitempty"`
// ping pong response data
GetResultURL string `json:"getResultUrl,omitempty"`
ProgressDesc string `json:"progressDesc,omitempty"`
QueryAbortsAfterSecs time.Duration `json:"queryAbortsAfterSecs,omitempty"`
}
type execResponse struct {
Data execResponseData `json:"Data"`
Message string `json:"message"`
Code string `json:"code"`
Success bool `json:"success"`
}