gormstore

package
v0.0.0-...-2a7283e Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotExists = datastore.ErrNotExists

Functions

func New

func New(ctx *cli.Context) (datastore.Datastore, error)

Types

type Gormstore

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

func (*Gormstore) AddPermissionToApplication

func (g *Gormstore) AddPermissionToApplication(ctx context.Context, appID, permissionID uint32) error

AddPermissionToApplication associates a Permission with an Application by their IDs.

func (*Gormstore) AddPermissionToUser

func (g *Gormstore) AddPermissionToUser(ctx context.Context, userID uint64, permissionID uint32) error

AddPermissionToUser associates a Permission with a User by their IDs.

func (*Gormstore) CreateApplication

func (g *Gormstore) CreateApplication(ctx context.Context, app *model.Application) error

CreateApplication creates a new Application in the database.

func (*Gormstore) CreatePermission

func (g *Gormstore) CreatePermission(ctx context.Context, permission *model.Permission) error

CreatePermission creates a new Permission in the database.

func (*Gormstore) CreateRateLimit

func (g *Gormstore) CreateRateLimit(ctx context.Context, rl *model.RateLimit) error

CreateRateLimit creates a new RateLimit in the database.

func (*Gormstore) CreateRequest

func (g *Gormstore) CreateRequest(ctx context.Context, req *model.Request) error

CreateRequest creates a new Request in the database.

func (*Gormstore) CreateUser

func (g *Gormstore) CreateUser(ctx context.Context, user *model.User) error

CreateUser creates a new User in the database.

func (*Gormstore) DeleteApplication

func (g *Gormstore) DeleteApplication(ctx context.Context, id uint32) error

DeleteApplication deletes an Application by ID from the database.

func (*Gormstore) DeletePermission

func (g *Gormstore) DeletePermission(ctx context.Context, id uint32) error

DeletePermission deletes a Permission by ID from the database.

func (*Gormstore) DeleteRateLimit

func (g *Gormstore) DeleteRateLimit(ctx context.Context, id uint32) error

DeleteRateLimit deletes a RateLimit by ID from the database.

func (*Gormstore) DeleteRequest

func (g *Gormstore) DeleteRequest(ctx context.Context, id uint32) error

DeleteRequest deletes a Request by ID from the database.

func (*Gormstore) DeleteUser

func (g *Gormstore) DeleteUser(ctx context.Context, id uint64) error

DeleteUser deletes a User by ID from the database.

func (*Gormstore) EnsureDefaultData

func (g *Gormstore) EnsureDefaultData(ctx context.Context) error

EnsureDefaultData checks if default data exists and seeds it if needed

func (*Gormstore) GetAllApplications

func (g *Gormstore) GetAllApplications(ctx context.Context) ([]model.Application, error)

GetAllApplications retrieves all Applications from the database.

func (*Gormstore) GetAllPermissions

func (g *Gormstore) GetAllPermissions(ctx context.Context) ([]model.Permission, error)

GetAllPermissions retrieves all Permissions from the database.

func (*Gormstore) GetAllRateLimits

func (g *Gormstore) GetAllRateLimits(ctx context.Context) ([]model.RateLimit, error)

GetAllRateLimits retrieves all RateLimits from the database.

func (*Gormstore) GetAllRequests

func (g *Gormstore) GetAllRequests(ctx context.Context) ([]model.Request, error)

GetAllRequests retrieves all Requests from the database.

func (*Gormstore) GetAllUsers

func (g *Gormstore) GetAllUsers(ctx context.Context, pagination *datastore.CursorPagination) ([]model.User, error)

GetAllUsers retrieves users from the database using cursor-based pagination.

func (*Gormstore) GetApplication

func (g *Gormstore) GetApplication(ctx context.Context, id uint32) (*model.Application, error)

GetApplication retrieves a single Application by ID.

func (*Gormstore) GetApplicationByAPIKey

func (g *Gormstore) GetApplicationByAPIKey(ctx context.Context, apiKey string) (*model.Application, error)

GetApplicationByAPIKey retrieves a single Application by its API key.

func (*Gormstore) GetApplicationCountForUser

func (g *Gormstore) GetApplicationCountForUser(ctx context.Context, userID uint64) (uint32, error)

GetApplicationCountForUser returns the number of applications associated with a specific user.

func (*Gormstore) GetApplicationsForUser

func (g *Gormstore) GetApplicationsForUser(ctx context.Context, userID uint64) ([]model.Application, error)

GetApplicationsForUser retrieves all Applications for a specific user.

func (*Gormstore) GetDefaultPermissions

func (g *Gormstore) GetDefaultPermissions(ctx context.Context) ([]model.Permission, error)

GetDefaultPermissions retrieves all default Permissions from the database.

func (*Gormstore) GetPermission

func (g *Gormstore) GetPermission(ctx context.Context, id uint32) (*model.Permission, error)

GetPermission retrieves a single Permission by ID.

func (*Gormstore) GetRateLimit

func (g *Gormstore) GetRateLimit(ctx context.Context, id uint32) (*model.RateLimit, error)

GetRateLimit retrieves a single RateLimit by ID.

func (*Gormstore) GetRequest

func (g *Gormstore) GetRequest(ctx context.Context, id uint32) (*model.Request, error)

GetRequest retrieves a single Request by ID.

func (*Gormstore) GetUser

func (g *Gormstore) GetUser(ctx context.Context, id uint64) (*model.User, error)

GetUser retrieves a single User by ID.

func (*Gormstore) RemovePermissionFromApplication

func (g *Gormstore) RemovePermissionFromApplication(ctx context.Context, appID, permissionID uint32) error

RemovePermissionFromApplication removes the association between a Permission and an Application by their IDs.

func (*Gormstore) RemovePermissionFromUser

func (g *Gormstore) RemovePermissionFromUser(ctx context.Context, userID uint64, permissionID uint32) error

RemovePermissionFromUser removes the association between a Permission and a User by their IDs.

func (*Gormstore) SetPermissionAsDefault

func (g *Gormstore) SetPermissionAsDefault(ctx context.Context, id uint32, isDefault bool) error

SetPermissionAsDefault sets whether a permission is default or not.

func (*Gormstore) UpdateApplication

func (g *Gormstore) UpdateApplication(ctx context.Context, app *model.Application) error

UpdateApplication updates an existing Application in the database.

func (*Gormstore) UpdatePermission

func (g *Gormstore) UpdatePermission(ctx context.Context, permission *model.Permission) error

UpdatePermission updates an existing Permission in the database.

func (*Gormstore) UpdateRateLimit

func (g *Gormstore) UpdateRateLimit(ctx context.Context, rl *model.RateLimit) error

UpdateRateLimit updates an existing RateLimit in the database.

func (*Gormstore) UpdateRequest

func (g *Gormstore) UpdateRequest(ctx context.Context, req *model.Request) error

UpdateRequest updates an existing Request in the database.

func (*Gormstore) UpdateUser

func (g *Gormstore) UpdateUser(ctx context.Context, user *model.User) error

UpdateUser updates an existing User in the database.

Jump to

Keyboard shortcuts

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