/
db.go
53 lines (48 loc) · 2.42 KB
/
db.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
package membersys
import (
"context"
)
// Data used by the HTML template. Contains not just data entered so far,
// but also some error texts in case there was a problem submitting data.
type FormInputData struct {
MemberData *Member
Metadata *MembershipMetadata
Key string
CommonErr string
FieldErr map[string]string
}
type MemberWithKey struct {
Key string `json:"key"`
Member
}
type MembershipAgreementWithKey struct {
Key string `json:"key"`
MembershipAgreement
}
type MembershipDB interface {
StoreMembershipRequest(context.Context, *FormInputData) (string, error)
GetMemberDetailByUsername(context.Context, string) (*MembershipAgreement, error)
GetMemberDetail(context.Context, string) (*MembershipAgreement, error)
SetMemberFee(context.Context, string, uint64, bool) error
SetLongValue(context.Context, string, string, uint64) error
SetBoolValue(context.Context, string, string, bool) error
SetTextValue(context.Context, string, string, string) error
GetMembershipRequest(context.Context, string) (*MembershipAgreement, error)
StreamingEnumerateMembers(context.Context, string, int32, chan<- *Member, chan<- error)
EnumerateMembers(context.Context, string, int32) ([]*Member, error)
StreamingEnumerateMembershipRequests(context.Context, string, string, int32, chan<- *MembershipAgreementWithKey, chan<- error)
EnumerateMembershipRequests(context.Context, string, string, int32) ([]*MembershipAgreementWithKey, error)
StreamingEnumerateQueuedMembers(context.Context, string, int32, chan<- *MemberWithKey, chan<- error)
EnumerateQueuedMembers(context.Context, string, int32) ([]*MemberWithKey, error)
StreamingEnumerateDeQueuedMembers(context.Context, string, int32, chan<- *MemberWithKey, chan<- error)
EnumerateDeQueuedMembers(context.Context, string, int32) ([]*MemberWithKey, error)
StreamingEnumerateTrashedMembers(context.Context, string, int32, chan<- *MemberWithKey, chan<- error)
EnumerateTrashedMembers(context.Context, string, int32) ([]*MemberWithKey, error)
MoveMemberToTrash(context.Context, string, string, string) error
MoveNewMemberToFullMember(context.Context, *MemberWithKey) error
MoveDeletedMemberToArchive(context.Context, *MemberWithKey) error
MoveApplicantToNewMember(context.Context, string, string) error
MoveApplicantToTrash(context.Context, string, string) error
MoveQueuedRecordToTrash(context.Context, string, string) error
StoreMembershipAgreement(context.Context, string, []byte) error
}