statping/core/export.go

60 lines
1.8 KiB
Go
Raw Normal View History

2018-12-04 05:57:11 +00:00
// Statping
2018-08-16 06:22:20 +00:00
// Copyright (C) 2018. Hunter Long and the project contributors
// Written by Hunter Long <info@socialeck.com> and the project contributors
//
2018-12-04 04:17:29 +00:00
// https://github.com/hunterlong/statping
2018-08-16 06:22:20 +00:00
//
// The licenses for most software and other practical works are designed
// to take away your freedom to share and change the works. By contrast,
// the GNU General Public License is intended to guarantee your freedom to
// share and change all versions of a program--to make sure it remains free
// software for all its users.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
2018-06-30 00:57:05 +00:00
package core
2018-06-23 05:59:29 +00:00
import (
2018-12-04 04:17:29 +00:00
"github.com/hunterlong/statping/types"
2018-06-23 05:59:29 +00:00
)
2018-10-07 04:48:33 +00:00
// ExportChartsJs renders the charts for the index page
2018-11-25 03:56:09 +00:00
type ExportData struct {
2020-02-25 07:41:28 +00:00
Core *types.Core `json:"core"`
Services []*types.Service `json:"services"`
Messages []*types.Message `json:"messages"`
Checkins []*types.Checkin `json:"checkins"`
Users []*types.User `json:"users"`
Groups []*types.Group `json:"groups"`
Notifiers []types.AllNotifiers `json:"notifiers"`
2018-11-25 03:56:09 +00:00
}
2019-01-09 04:20:43 +00:00
// ExportSettings will export a JSON file containing all of the settings below:
// - Core
// - Notifiers
// - Checkins
// - Users
// - Services
// - Groups
// - Messages
2020-02-25 07:41:28 +00:00
//func ExportSettings() ([]byte, error) {
// users, err := SelectAllUsers()
// messages, err := SelectMessages()
// if err != nil {
// return nil, err
// }
// data := ExportData{
// Core: CoreApp.Core,
// Notifiers: CoreApp.Notifications,
// Checkins: database.AllCheckins(),
// Users: database.AllUsers(),
// Services: CoreApp.Services,
// Groups: SelectGroups(true, true),
// Messages: messages,
// }
// export, err := json.Marshal(data)
// return export, err
//}