db

package
v0.0.0-...-f839926 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EndpointStore

type EndpointStore struct {
	// contains filtered or unexported fields
}

func NewEndpointStore

func NewEndpointStore(db *pgxpool.Pool, l *slog.Logger) *EndpointStore

func (*EndpointStore) AllForUser

func (es *EndpointStore) AllForUser(ctx context.Context, userId string) ([]*models.Endpoint, error)

func (*EndpointStore) Delete

func (es *EndpointStore) Delete(ctx context.Context, endpoint *models.Endpoint, userId string) error

func (*EndpointStore) ExistsByOriginal

func (es *EndpointStore) ExistsByOriginal(ctx context.Context, endpoint *models.Endpoint, userId string) (bool, error)

func (*EndpointStore) ExistsByThrottlr

func (es *EndpointStore) ExistsByThrottlr(ctx context.Context, endpoint *models.Endpoint, userId string) (bool, error)

func (*EndpointStore) Fill

func (es *EndpointStore) Fill(ctx context.Context, endpoint *models.Endpoint, userId string) error

func (*EndpointStore) Get

func (es *EndpointStore) Get(ctx context.Context, throttlrPath, userId string) (*models.Endpoint, error)

func (*EndpointStore) Store

func (es *EndpointStore) Store(ctx context.Context, e *models.Endpoint, userId string) (int, error)

func (*EndpointStore) Update

func (es *EndpointStore) Update(ctx context.Context, endpoint *models.Endpoint, userId string) error

func (*EndpointStore) UpdateBucketCount

func (es *EndpointStore) UpdateBucketCount(ctx context.Context, endpoint *models.Endpoint, userId string) error

func (*EndpointStore) UpdateWindowOpenedAt

func (es *EndpointStore) UpdateWindowOpenedAt(ctx context.Context, endpoint *models.Endpoint, userId string) error

type KeyStore

type KeyStore struct {
	// contains filtered or unexported fields
}

func NewKeyStore

func NewKeyStore(db *pgxpool.Pool) *KeyStore

func (*KeyStore) Exists

func (ks *KeyStore) Exists(key string, ctx context.Context) (bool, int)

func (*KeyStore) IdFromKey

func (ks *KeyStore) IdFromKey(key string, ctx context.Context) (string, error)

func (*KeyStore) UserIdFromKey

func (ks *KeyStore) UserIdFromKey(key string, ctx context.Context) (string, error)

func (*KeyStore) Valid

func (ks *KeyStore) Valid(id int, ctx context.Context) bool

type UserStore

type UserStore struct {
	// contains filtered or unexported fields
}

func NewUserStore

func NewUserStore(db *pgxpool.Pool) *UserStore

func (*UserStore) ById

func (us *UserStore) ById(ctx context.Context, id string) (*models.User, error)

func (*UserStore) Delete

func (us *UserStore) Delete(ctx context.Context, id string) error

func (*UserStore) RegenerateApiKey

func (us *UserStore) RegenerateApiKey(ctx context.Context, u models.User) (uuid.UUID, error)

func (*UserStore) Store

func (us *UserStore) Store(ctx context.Context, u models.User) error

Jump to

Keyboard shortcuts

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