-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
role.go
47 lines (38 loc) · 1.06 KB
/
role.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
// Copyright 2022 Clivern. All rights reserved.
// Use of this source code is governed by the MIT
// license that can be found in the LICENSE file.
package model
import (
"time"
"github.com/clivern/chaos/core/util"
)
// Role struct
type Role struct {
ID int `json:"id"`
Name string `json:"name"`
Value string `json:"value"`
StartAt time.Time `json:"startAt"`
EndAt time.Time `json:"endAt"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
}
// Roles struct
type Roles struct {
Roles []Role `json:"roles"`
}
// LoadFromJSON update object from json
func (o *Role) LoadFromJSON(data []byte) error {
return util.LoadFromJSON(o, data)
}
// ConvertToJSON convert object to json
func (o *Role) ConvertToJSON() (string, error) {
return util.ConvertToJSON(o)
}
// LoadFromJSON update object from json
func (o *Roles) LoadFromJSON(data []byte) error {
return util.LoadFromJSON(o, data)
}
// ConvertToJSON convert object to json
func (o *Roles) ConvertToJSON() (string, error) {
return util.ConvertToJSON(o)
}