forked from statping/statping
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
73 lines (63 loc) · 1.31 KB
/
main.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
71
72
73
package plugin
import (
"fmt"
"net/http"
"upper.io/db.v3/lib/sqlbuilder"
)
//
// STATUP PLUGIN INTERFACE
//
// v0.1
//
// https://statup.io
//
//
// An expandable plugin framework that will still
// work even if there's an update or addition.
//
var (
DB sqlbuilder.Database
)
func SetDatabase(database sqlbuilder.Database) {
DB = database
}
func Throw(err error) {
fmt.Println(err)
}
type PluginInfo struct {
Info Info
PluginActions
}
func (p *PluginInfo) Form() string {
return "okkokokkok"
}
type PluginActions interface {
GetInfo() Info
GetForm() string
SetInfo(map[string]interface{}) Info
Routes() []Routing
OnSave(map[string]interface{})
OnFailure(map[string]interface{})
OnSuccess(map[string]interface{})
OnSettingsSaved(map[string]interface{})
OnNewUser(map[string]interface{})
OnNewService(map[string]interface{})
OnUpdatedService(map[string]interface{})
OnDeletedService(map[string]interface{})
OnInstall(map[string]interface{})
OnUninstall(map[string]interface{})
OnBeforeRequest(map[string]interface{})
OnAfterRequest(map[string]interface{})
OnShutdown()
OnLoad(sqlbuilder.Database)
}
type Routing struct {
URL string
Method string
Handler func(http.ResponseWriter, *http.Request)
}
type Info struct {
Name string
Description string
Form string
}