common

package
v1.57.2 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CombineFilterWithAccessibleIds added in v1.51.0

func CombineFilterWithAccessibleIds(filterIds []*int64, accessibleIds []*int64) []*int64

CombineFilterWithAccessibleIds combines filterIds and accessibleIds based on the following rules: - If accessibleIds is empty, return filterIds (full access) - If accessibleIds contains only -1, return [-1] (no access) - If filterIds is empty, return accessibleIds (use accessibleIds as filter) - Otherwise, calculate & return the intersection of filterIds and accessibleIds

func EnsureListOptions added in v1.25.0

func EnsureListOptions(options *entity.ListOptions) *entity.ListOptions

func EnsurePaginated

func EnsurePaginated(filter *entity.Paginated)

func GetCurrentUniqueUserId added in v1.54.0

func GetCurrentUniqueUserId(ctx context.Context) (string, error)

func GetCurrentUserId

func GetCurrentUserId(ctx context.Context, db database.Database) (int64, error)

func GetPageInfo

func GetPageInfo[T entity.HasCursor](
	res []T,
	cursors []string,
	pageSize int,
	currentCursor *string,
) *entity.PageInfo

func GetPages

func GetPages(firstCursor *string, cursors []string, pageSize int) ([]entity.Page, entity.Page)

func GetTestConfig added in v1.47.0

func GetTestConfig(authEnabled bool) *util.Config

func GetUserIdByUniqueId added in v1.54.0

func GetUserIdByUniqueId(
	ctx context.Context,
	db database.Database,
	uniqueUserId string,
) (int64, error)

func Int64Ptr added in v1.51.0

func Int64Ptr(i int64) *int64

Int64Ptr returns a pointer to the given int64 value.

func NewAdminContext added in v1.26.0

func NewAdminContext() context.Context

Types

type HandlerContext added in v1.24.0

type HandlerContext struct {
	DB       database.Database
	EventReg event.EventRegistry
	Cache    cache.Cache
	Authz    openfga.Authorization
}

Jump to

Keyboard shortcuts

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