Documentation
¶
Index ¶
- func CheckEmptyString(text string) (*string, error)
- func CheckIdentifierExists(profile *profileutils.UserProfile, UID string) bool
- func CheckUserHasPermission(roles []profileutils.Role, permission profileutils.Permission) bool
- func FindItem(slice []string, value string) (int, bool)
- func GetRandomName() *string
- func GetUserNavigationActions(ctx context.Context, user profileutils.UserProfile, roles []profileutils.Role) (*dto.GroupedNavigationActions, error)
- func GetUserPermissions(roles []profileutils.Role) []string
- func GetUserResponse(text string) string
- func GroupNested(actions []domain.NavigationAction) []domain.NavigationAction
- func GroupPriority(actions []domain.NavigationAction) (primary, secondary []domain.NavigationAction)
- func IsFavNavAction(u *profileutils.UserProfile, title string) bool
- func IsLetter(s string) bool
- func MatchAndReturn(old bool, new bool) bool
- func NewActionsMapper(ctx context.Context, grouped *dto.GroupedNavigationActions) *profileutils.NavigationActions
- func NewInterServiceClient(serviceName string, baseExt extension.BaseExtension) *interserviceclient.InterServiceClient
- func RecordSpanError(span trace.Span, err error)
- func RemoveDuplicateStrings(strings []string) []string
- func ServiceHealthEndPoint(input string) (string, error)
- func UniquePermissionsArray(arr []profileutils.PermissionType) []profileutils.PermissionType
- func ValidateDateDigits(pin string) error
- func ValidateDateLength(date string) error
- func ValidatePIN(pin string) error
- func ValidatePINLength(pin string) error
- func ValidateRegisterUserInput(input dto.RegisterUserInput) (bool, error)
- func ValidateSignUpInput(input *dto.SignUpInput) (*dto.SignUpInput, error)
- func ValidateUID(w http.ResponseWriter, r *http.Request) (*dto.UIDPayload, error)
- func ValidateYearOfBirth(date string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckEmptyString ¶
CheckEmptyString check that the string isn't empty
func CheckIdentifierExists ¶
func CheckIdentifierExists(profile *profileutils.UserProfile, UID string) bool
CheckIdentifierExists check if an identifier exists
func CheckUserHasPermission ¶ added in v0.0.2
func CheckUserHasPermission(roles []profileutils.Role, permission profileutils.Permission) bool
CheckUserHasPermission takes in the user roles and a permission and verifies that the user has required permissions
func FindItem ¶
FindItem is a linear search implementation that checks if a string is contained in a slice and returns its index and a boolean The index can be used for slicing out an item from a slice.
func GetRandomName ¶
func GetRandomName() *string
GetRandomName generates a random name from the list of adjectives and surnames in this package formatted as "adjective_surname". For example '@focused_turing23254'. If retry is non-zero, a random integer between 0 and 10 will be added to the end of the name, e.g `focused_turing3`
func GetUserNavigationActions ¶ added in v0.0.2
func GetUserNavigationActions( ctx context.Context, user profileutils.UserProfile, roles []profileutils.Role, ) (*dto.GroupedNavigationActions, error)
GetUserNavigationActions returns a sorted primary and secondary user navigation actions
func GetUserPermissions ¶ added in v0.0.2
func GetUserPermissions(roles []profileutils.Role) []string
GetUserPermissions returns all the scopes of user permissions
func GetUserResponse ¶
GetUserResponse gets the concatenated text from Africans Talking and splits it to get the current user input
func GroupNested ¶ added in v0.0.2
func GroupNested( actions []domain.NavigationAction, ) []domain.NavigationAction
GroupNested groups navigation actions into parents and children
func GroupPriority ¶ added in v0.0.2
func GroupPriority(actions []domain.NavigationAction) (primary, secondary []domain.NavigationAction)
GroupPriority groups navigation actions into primary and secondary actions
func IsFavNavAction ¶ added in v0.0.2
func IsFavNavAction(u *profileutils.UserProfile, title string) bool
IsFavNavAction checks if user has book marked the provided navaction
func MatchAndReturn ¶
MatchAndReturn checks is the new is not equal to old and returns it. Otherwise the old used when setting communication settings
func NewActionsMapper ¶ added in v0.0.2
func NewActionsMapper(ctx context.Context, grouped *dto.GroupedNavigationActions) *profileutils.NavigationActions
NewActionsMapper maps the new navigation actions mapper to the old navigation actions implementation It is meant to be used as a transition and ease changes made without affecting the frontend
func NewInterServiceClient ¶
func NewInterServiceClient(serviceName string, baseExt extension.BaseExtension) *interserviceclient.InterServiceClient
NewInterServiceClient initializes an external service in the correct environment given its name
func RecordSpanError ¶
RecordSpanError is a helper function to capture errors in a span
func RemoveDuplicateStrings ¶ added in v0.0.2
RemoveDuplicateStrings removes duplicate strings from a list of strings
func ServiceHealthEndPoint ¶
ServiceHealthEndPoint creates a url to the service health endpoint
func UniquePermissionsArray ¶
func UniquePermissionsArray(arr []profileutils.PermissionType) []profileutils.PermissionType
UniquePermissionsArray removes duplicate permissions in an array of permissions
func ValidateDateDigits ¶
ValidateDateDigits validates user pin to ensure a PIN only contains digits
func ValidateDateLength ¶
ValidateDateLength ensures that the dates are of only 8 numbers
func ValidateRegisterUserInput ¶ added in v0.0.10
func ValidateRegisterUserInput(input dto.RegisterUserInput) (bool, error)
ValidateRegisterUserInput validates the user registration input
func ValidateSignUpInput ¶
func ValidateSignUpInput(input *dto.SignUpInput) (*dto.SignUpInput, error)
ValidateSignUpInput returns a valid sign up input
func ValidateUID ¶
func ValidateUID(w http.ResponseWriter, r *http.Request) (*dto.UIDPayload, error)
ValidateUID checks that the uid supplied in the indicated request is valid
func ValidateYearOfBirth ¶
ValidateYearOfBirth validates that the year enter is 18 years and above
Types ¶
This section is empty.