Documentation
¶
Index ¶
- Variables
- func New(ctx *cli.Context) (datastore.Datastore, error)
- type Gormstore
- func (g *Gormstore) AddPermissionToApplication(ctx context.Context, appID, permissionID uint32) error
- func (g *Gormstore) AddPermissionToUser(ctx context.Context, userID uint64, permissionID uint32) error
- func (g *Gormstore) CreateApplication(ctx context.Context, app *model.Application) error
- func (g *Gormstore) CreatePermission(ctx context.Context, permission *model.Permission) error
- func (g *Gormstore) CreateRateLimit(ctx context.Context, rl *model.RateLimit) error
- func (g *Gormstore) CreateRequest(ctx context.Context, req *model.Request) error
- func (g *Gormstore) CreateUser(ctx context.Context, user *model.User) error
- func (g *Gormstore) DeleteApplication(ctx context.Context, id uint32) error
- func (g *Gormstore) DeletePermission(ctx context.Context, id uint32) error
- func (g *Gormstore) DeleteRateLimit(ctx context.Context, id uint32) error
- func (g *Gormstore) DeleteRequest(ctx context.Context, id uint32) error
- func (g *Gormstore) DeleteUser(ctx context.Context, id uint64) error
- func (g *Gormstore) EnsureDefaultData(ctx context.Context) error
- func (g *Gormstore) GetAllApplications(ctx context.Context) ([]model.Application, error)
- func (g *Gormstore) GetAllPermissions(ctx context.Context) ([]model.Permission, error)
- func (g *Gormstore) GetAllRateLimits(ctx context.Context) ([]model.RateLimit, error)
- func (g *Gormstore) GetAllRequests(ctx context.Context) ([]model.Request, error)
- func (g *Gormstore) GetAllUsers(ctx context.Context, pagination *datastore.CursorPagination) ([]model.User, error)
- func (g *Gormstore) GetApplication(ctx context.Context, id uint32) (*model.Application, error)
- func (g *Gormstore) GetApplicationByAPIKey(ctx context.Context, apiKey string) (*model.Application, error)
- func (g *Gormstore) GetApplicationCountForUser(ctx context.Context, userID uint64) (uint32, error)
- func (g *Gormstore) GetApplicationsForUser(ctx context.Context, userID uint64) ([]model.Application, error)
- func (g *Gormstore) GetDefaultPermissions(ctx context.Context) ([]model.Permission, error)
- func (g *Gormstore) GetPermission(ctx context.Context, id uint32) (*model.Permission, error)
- func (g *Gormstore) GetRateLimit(ctx context.Context, id uint32) (*model.RateLimit, error)
- func (g *Gormstore) GetRequest(ctx context.Context, id uint32) (*model.Request, error)
- func (g *Gormstore) GetUser(ctx context.Context, id uint64) (*model.User, error)
- func (g *Gormstore) RemovePermissionFromApplication(ctx context.Context, appID, permissionID uint32) error
- func (g *Gormstore) RemovePermissionFromUser(ctx context.Context, userID uint64, permissionID uint32) error
- func (g *Gormstore) SetPermissionAsDefault(ctx context.Context, id uint32, isDefault bool) error
- func (g *Gormstore) UpdateApplication(ctx context.Context, app *model.Application) error
- func (g *Gormstore) UpdatePermission(ctx context.Context, permission *model.Permission) error
- func (g *Gormstore) UpdateRateLimit(ctx context.Context, rl *model.RateLimit) error
- func (g *Gormstore) UpdateRequest(ctx context.Context, req *model.Request) error
- func (g *Gormstore) UpdateUser(ctx context.Context, user *model.User) error
Constants ¶
This section is empty.
Variables ¶
var ErrNotExists = datastore.ErrNotExists
Functions ¶
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 ¶
CreateApplication creates a new Application in the database.
func (*Gormstore) CreatePermission ¶
CreatePermission creates a new Permission in the database.
func (*Gormstore) CreateRateLimit ¶
CreateRateLimit creates a new RateLimit in the database.
func (*Gormstore) CreateRequest ¶
CreateRequest creates a new Request in the database.
func (*Gormstore) CreateUser ¶
CreateUser creates a new User in the database.
func (*Gormstore) DeleteApplication ¶
DeleteApplication deletes an Application by ID from the database.
func (*Gormstore) DeletePermission ¶
DeletePermission deletes a Permission by ID from the database.
func (*Gormstore) DeleteRateLimit ¶
DeleteRateLimit deletes a RateLimit by ID from the database.
func (*Gormstore) DeleteRequest ¶
DeleteRequest deletes a Request by ID from the database.
func (*Gormstore) DeleteUser ¶
DeleteUser deletes a User by ID from the database.
func (*Gormstore) EnsureDefaultData ¶
EnsureDefaultData checks if default data exists and seeds it if needed
func (*Gormstore) GetAllApplications ¶
GetAllApplications retrieves all Applications from the database.
func (*Gormstore) GetAllPermissions ¶
GetAllPermissions retrieves all Permissions from the database.
func (*Gormstore) GetAllRateLimits ¶
GetAllRateLimits retrieves all RateLimits from the database.
func (*Gormstore) GetAllRequests ¶
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 ¶
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 ¶
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 ¶
GetDefaultPermissions retrieves all default Permissions from the database.
func (*Gormstore) GetPermission ¶
GetPermission retrieves a single Permission by ID.
func (*Gormstore) GetRateLimit ¶
GetRateLimit retrieves a single RateLimit by ID.
func (*Gormstore) GetRequest ¶
GetRequest retrieves a single Request 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 ¶
SetPermissionAsDefault sets whether a permission is default or not.
func (*Gormstore) UpdateApplication ¶
UpdateApplication updates an existing Application in the database.
func (*Gormstore) UpdatePermission ¶
UpdatePermission updates an existing Permission in the database.
func (*Gormstore) UpdateRateLimit ¶
UpdateRateLimit updates an existing RateLimit in the database.
func (*Gormstore) UpdateRequest ¶
UpdateRequest updates an existing Request in the database.