backend

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDefaultBackend

func NewDefaultBackend(projectID string, apiToken string) Backend

NewDefaultBackend initializes the S3 Backend

func NewS3Backend

func NewS3Backend(projectID string, bucket string, region string, accessKeyID string, secretAccessKey string) Backend

NewS3Backend initializes the S3 Backend

Types

type DefaultBackend

type DefaultBackend struct {
	ApiToken   string
	BackendURL string
	ProjectID  string
}

func (*DefaultBackend) Bind added in v0.3.0

func (b *DefaultBackend) Bind(planID string, userID string) error

func (*DefaultBackend) Decrement

func (b *DefaultBackend) Decrement(featureID string, userID string, value int) error

func (*DefaultBackend) Feature

func (b *DefaultBackend) Feature(featureID string, userID string) bool

func (*DefaultBackend) FeatureMatrix

func (b *DefaultBackend) FeatureMatrix() (*FeatureMatrix, error)

func (*DefaultBackend) Increment

func (b *DefaultBackend) Increment(featureID string, userID string, value int) error

func (*DefaultBackend) Set

func (b *DefaultBackend) Set(featureID string, userID string, value int) error

func (*DefaultBackend) Usage

func (b *DefaultBackend) Usage(userID string) (*FeatureUsage, error)

type FeatureResp

type FeatureResp struct {
	Allow  bool   `json:"allow"`
	Reason string `json:"reason"`
}

type S3Backend

type S3Backend struct {
	S3Client  *s3.S3
	S3Bucket  string
	ProjectID string
}

func (*S3Backend) Bind added in v0.3.0

func (b *S3Backend) Bind(planID string, userID string) error

func (*S3Backend) Decrement

func (b *S3Backend) Decrement(featureID string, userID string, value int) error

func (*S3Backend) Feature

func (b *S3Backend) Feature(featureID string, userID string) bool

func (*S3Backend) FeatureMatrix

func (b *S3Backend) FeatureMatrix() (*FeatureMatrix, error)

func (*S3Backend) Increment

func (b *S3Backend) Increment(featureID string, userID string, value int) error

func (*S3Backend) Set

func (b *S3Backend) Set(featureID string, userID string, value int) error

func (*S3Backend) Usage

func (b *S3Backend) Usage(userID string) (*FeatureUsage, error)

Jump to

Keyboard shortcuts

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