working on rethinkdb stuff
This commit is contained in:
+23
-16
@@ -3,20 +3,39 @@ package models
|
||||
import (
|
||||
"encoding/json"
|
||||
"io"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Dashboard struct {
|
||||
Data map[string]interface{}
|
||||
Id string `gorethink:"id,omitempty"`
|
||||
AccountId string
|
||||
LastModifiedByUserId string
|
||||
LastModifiedByDate time.Time
|
||||
CreatedDate time.Time
|
||||
|
||||
Title string
|
||||
Tags []string
|
||||
Data map[string]interface{}
|
||||
}
|
||||
|
||||
type UserContext struct {
|
||||
UserId string
|
||||
AccountId string
|
||||
}
|
||||
|
||||
type SearchResult struct {
|
||||
Type string `json:"title"`
|
||||
Id string `json:"id"`
|
||||
Title string `json:"title"`
|
||||
}
|
||||
|
||||
func NewDashboard(title string) *Dashboard {
|
||||
dash := &Dashboard{}
|
||||
dash.Id = ""
|
||||
dash.AccountId = "test"
|
||||
dash.LastModifiedByDate = time.Now()
|
||||
dash.CreatedDate = time.Now()
|
||||
dash.LastModifiedByUserId = "123"
|
||||
dash.Title = title
|
||||
dash.Data = make(map[string]interface{})
|
||||
dash.Data["title"] = title
|
||||
|
||||
@@ -31,23 +50,11 @@ func NewFromJson(reader io.Reader) (*Dashboard, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
dash.Title = dash.Data["title"].(string)
|
||||
|
||||
return dash, nil
|
||||
}
|
||||
|
||||
/*type DashboardServices struct {
|
||||
}
|
||||
|
||||
type DashboardServicesFilter struct {
|
||||
}
|
||||
|
||||
type DashboardServicesFilterTime struct {
|
||||
From string To string
|
||||
}*/
|
||||
|
||||
func (dash *Dashboard) GetString(prop string) string {
|
||||
return dash.Data[prop].(string)
|
||||
}
|
||||
|
||||
func (dash *Dashboard) Title() string {
|
||||
return dash.GetString("title")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user