mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
member providers extracted config.
This commit is contained in:
@ -7,23 +7,20 @@ import (
|
||||
"demodesk/neko/internal/types"
|
||||
)
|
||||
|
||||
func New() types.MemberManager {
|
||||
func New(config Config) types.MemberManager {
|
||||
return &MemberManagerCtx{
|
||||
config: config,
|
||||
entries: make(map[string]MemberEntry),
|
||||
mu: sync.Mutex{},
|
||||
}
|
||||
}
|
||||
|
||||
type MemberManagerCtx struct {
|
||||
config Config
|
||||
entries map[string]MemberEntry
|
||||
mu sync.Mutex
|
||||
}
|
||||
|
||||
type MemberEntry struct {
|
||||
Password string `json:"password"`
|
||||
Profile types.MemberProfile `json:"profile"`
|
||||
}
|
||||
|
||||
func (manager *MemberManagerCtx) Connect() error {
|
||||
return nil
|
||||
}
|
||||
@ -123,7 +120,7 @@ func (manager *MemberManagerCtx) SelectAll(limit int, offset int) (map[string]ty
|
||||
|
||||
i := 0
|
||||
for id, entry := range manager.entries {
|
||||
if i < offset || i > offset + limit {
|
||||
if i < offset || i > offset+limit {
|
||||
continue
|
||||
}
|
||||
|
||||
|
15
internal/member/object/types.go
Normal file
15
internal/member/object/types.go
Normal file
@ -0,0 +1,15 @@
|
||||
package object
|
||||
|
||||
import (
|
||||
"demodesk/neko/internal/types"
|
||||
)
|
||||
|
||||
type MemberEntry struct {
|
||||
Password string `json:"password"`
|
||||
Profile types.MemberProfile `json:"profile"`
|
||||
}
|
||||
|
||||
type Config struct {
|
||||
AdminPassword string
|
||||
UserPassword string
|
||||
}
|
Reference in New Issue
Block a user