-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprovider.go
More file actions
27 lines (23 loc) · 1.06 KB
/
Copy pathprovider.go
File metadata and controls
27 lines (23 loc) · 1.06 KB
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
package MoneyBot
import "github.com/shvimas/teleBot"
type Provider interface {
Connect() error
Close() error
GetUser(int) (*user, error)
GetContainer(int) (*container, error)
GetHistory(int) (*history, error)
PushContainer(int, *container) error
PushHistory(int, *history) error
RegisterUser(teleBot.User) error // rewrites user and all his data if already had
}
type DummyProvider struct {
Error error
}
func (dp DummyProvider) Connect() error { return dp.Error }
func (dp DummyProvider) Close() error { return dp.Error }
func (dp DummyProvider) GetUser(int) (*user, error) { return nil, dp.Error }
func (dp DummyProvider) GetContainer(int) (*container, error) { return nil, dp.Error }
func (dp DummyProvider) GetHistory(int) (*history, error) { return nil, dp.Error }
func (dp DummyProvider) PushContainer(*user) error { return dp.Error }
func (dp DummyProvider) PushHistory(*user) error { return dp.Error }
func (dp DummyProvider) RegisterUser(teleBot.User) error { return dp.Error }