mirror of
https://github.com/aclindsa/moneygo.git
synced 2025-07-01 12:08:37 -04:00
Move Report and Series definitions to be in line with others
This commit is contained in:
@ -1,33 +1,12 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"github.com/yuin/gopher-lua"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
const luaReportTypeName = "report"
|
||||
const luaSeriesTypeName = "series"
|
||||
|
||||
type Series struct {
|
||||
Values []float64
|
||||
Children map[string]*Series
|
||||
}
|
||||
|
||||
type Report struct {
|
||||
Title string
|
||||
Subtitle string
|
||||
XAxisLabel string
|
||||
YAxisLabel string
|
||||
Labels []string
|
||||
Series map[string]*Series
|
||||
}
|
||||
|
||||
func (r *Report) Write(w http.ResponseWriter) error {
|
||||
enc := json.NewEncoder(w)
|
||||
return enc.Encode(r)
|
||||
}
|
||||
|
||||
func luaRegisterReports(L *lua.LState) {
|
||||
mtr := L.NewTypeMetatable(luaReportTypeName)
|
||||
L.SetGlobal("report", mtr)
|
||||
|
Reference in New Issue
Block a user