-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbima.go
92 lines (74 loc) · 1.67 KB
/
bima.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
package bima
import (
"github.com/bimalabs/framework/v4/handlers"
"github.com/bimalabs/framework/v4/messengers"
"github.com/bimalabs/framework/v4/models"
"github.com/bimalabs/framework/v4/paginations"
"github.com/bimalabs/framework/v4/utils"
"github.com/olivere/elastic/v7"
"gorm.io/gorm"
)
const (
Version = "v4.3.11"
HighestPriority = 255
LowestPriority = -255
Application = "application"
Generator = "generator"
)
type (
Module interface {
Debug() bool
Handler() handlers.Handler
Cache() *utils.Cache
Paginator() *paginations.Pagination
Validate(v interface{}) (string, error)
}
module struct {
debug bool
handler handlers.Handler
cache *utils.Cache
paginator *paginations.Pagination
validator utils.Validator
}
GormModel struct {
models.GormBase
}
Server struct {
Debug bool
}
)
func NewModule(debug bool, handler handlers.Handler, cache *utils.Cache, validator utils.Validator, paginator *paginations.Pagination) Module {
return &module{
debug: debug,
handler: handler,
cache: cache,
paginator: paginator,
validator: validator,
}
}
func (m *module) Debug() bool {
return m.debug
}
func (m *module) Handler() handlers.Handler {
return m.handler
}
func (m *module) Cache() *utils.Cache {
return m.cache
}
func (m *module) Paginator() *paginations.Pagination {
return m.paginator
}
func (m *module) Validate(v interface{}) (string, error) {
return m.validator.Validate(v)
}
func NewModel() GormModel {
return GormModel{
GormBase: models.GormBase{},
}
}
func (s *Server) Consume(messenger *messengers.Messenger) {
}
func (s *Server) Sync(client *elastic.Client) {
}
func (s *Server) Migrate(db *gorm.DB) {
}