-
Notifications
You must be signed in to change notification settings - Fork 0
/
MDXView.go
38 lines (31 loc) · 868 Bytes
/
MDXView.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
package tm1go
import "encoding/json"
type MDXView struct {
Cube Cube `json:"Cube,omitempty"`
Type string `json:"@odata.type"`
Name string `json:"Name"`
MDX string `json:"MDX"`
Meta struct {
Aliases map[string]string `json:"Aliases"`
ContextSets map[string]map[string]string `json:"ContextSets"`
ExpandAboves map[string]bool `json:"ExpandAboves"`
} `json:"Meta,omitempty"`
}
func (v *MDXView) GetType() string {
return v.Type
}
func (v *MDXView) GetName() string {
return v.Name
}
func (v *MDXView) getBody(static bool) (string, error) {
bodyAsDict := make(map[string]interface{})
bodyAsDict["@odata.type"] = v.Type
bodyAsDict["Name"] = v.Name
bodyAsDict["MDX"] = v.MDX
bodyAsDict["Meta"] = v.Meta
jsonData, err := json.Marshal(bodyAsDict)
if err != nil {
return "", err
}
return string(jsonData), nil
}