collection

package module
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 7, 2022 License: MIT Imports: 7 Imported by: 1

README

collection

Collections of Data with are stored in Document Databases like Firestore or DynamoDB Currently only Firestore is supported

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Collection

type Collection interface {
	GetUser(context.Context, string) (UserItem, error)
	GetDomain(context.Context, string) (Domain, error)
}

func NewFirestoreCollection

func NewFirestoreCollection(ctx context.Context, sc *firestore.Client) Collection

type Domain

type Domain struct {
	Name         string `firestore:"name"`
	Dnsprovider  string `firestore:"dnsprovider"`
	ZoneID       string `firestore:"zoneid"`
	AccessKey    string `firestore:"accesskey"`
	AccessSecret string `firestore:"accesssecret"`
	TTL          int64  `firestore:"ttl"`
}

type FsCollection

type FsCollection struct {
	StorageClient *firestore.Client
	RootContext   context.Context
}

Currently only implemented for Firestore, later we will make dynamoDB possbile

func (FsCollection) GetDomain

func (c FsCollection) GetDomain(ctx context.Context, k string) (Domain, error)

func (FsCollection) GetUser

func (c FsCollection) GetUser(ctx context.Context, k string) (UserItem, error)

type User

type User struct {
	Login     string   `firestore:"login"`
	Passwd    string   `firestore:"passwd"`
	Salt      string   `firestore:"salt"`
	Domains   []string `firestore:"domains"`
	Apps      []string `firestore:"apps"`
	Lastname  string   `firestore:"lastname"`
	Firstname string   `firestore:"firstname"`
}

func (User) VerifyApp

func (u User) VerifyApp(n string) bool

func (User) VerifyDomain

func (u User) VerifyDomain(n string) bool

func (User) VerifyPasswd

func (u User) VerifyPasswd(k string) bool

type UserItem added in v0.1.0

type UserItem interface {
	VerifyPasswd(string) bool
	VerifyApp(string) bool
	VerifyDomain(string) bool
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL