utility

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2025 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MapActionName = map[string]string{
	"UpdateProfileResolverFn":        "update user profile",
	"UpsertPluginResolverFn":         "plugin modification",
	"GenerateApiTokenResolverFn":     "generated api token",
	"DeleteApiTokenResolverFn":       "deleted api token",
	"CreateWebHookResolverFn":        "created a webhook",
	"DeleteWebHookResolverFn":        "deleted a webhook",
	"UpdateProjectResolverFn":        "updated a project information",
	"AddModelToProjectResolverFn":    "added a model to a project",
	"UpdateModelResolverFn":          "updated a model",
	"UpsertRoleToProjectResolverFn":  "added or modified a role to a project",
	"DeleteRoleResolverFn":           "deleted a role",
	"UpsertFieldToModelResolverFn":   "added or modified a field to a model",
	"DeleteFieldTypeResolverFn":      "deleted a field",
	"ModelFieldOperationResolverFn":  "modified a field of a model",
	"CreateConnectionTypeResolverFn": "created a connection between models",
	"UpsertModelDataFnFn":            "added or modified data of a model",
	"DeleteModelDataFnFn":            "deleted data of a model",
}
View Source
var SupportedLocals = []string{}/* 609 elements not displayed */

Functions

func AddDaysWithCurrentDhakaTime

func AddDaysWithCurrentDhakaTime(days int) string

func AddDaysWithCurrentTime

func AddDaysWithCurrentTime(days int) string

func ArrayContains

func ArrayContains(arr []string, str string) bool

func ArrayContainsInterface

func ArrayContainsInterface(arr []interface{}, val interface{}) bool

func BuildAsyncContext

func BuildAsyncContext(ctx context.Context) (context.Context, context.CancelFunc)

func BuildCRUDPermissions

func BuildCRUDPermissions(modelName string, role *models.Role) (*models.APIPermission, error)

func CaptureInternalServerError

func CaptureInternalServerError(err error, scopes map[string]interface{}) error

func ConnectDisconnectParamBuilder

func ConnectDisconnectParamBuilder(project *models.Project, uid string, connectionIds map[string]interface{}, modelType *models.ModelType) ([]*models.ConnectDisconnectParam, error)

func ExtractActionName

func ExtractActionName(name string) string

func ExtractGraphQLOperationName

func ExtractGraphQLOperationName(query string, schema *models.ProjectSchema, isSystemQuery bool) ([]*models.IncomingRequest, error)

func ExtractModelNames

func ExtractModelNames(schema *models.ProjectSchema, queryDoc *ast.QueryDocument) ([]*models.IncomingRequest, bool, error)

func ExtractRelationName

func ExtractRelationName(name string) string

func ExtractResourceName

func ExtractResourceName(name string) string

separate update,delete,create from model name

func FilterNumber

func FilterNumber(num string) (string, error)

func FilterProjectArray

func FilterProjectArray(arr *[]*models.Project, key string) *models.Project

FilterProjectArray filters the array by a key and removes the found item from the array

func FilterUserArray

func FilterUserArray(arr *[]*models.SystemUser, key string) *models.SystemUser

FilterUserArray filters the array by a key and removes the found item from the array

func GenerateCombinedQuery

func GenerateCombinedQuery(doc *ast.QueryDocument, fragments map[string]*ast.FragmentDefinition) string

New function to generate the combined output as a single string

func GetCurrentDhakaTime

func GetCurrentDhakaTime() string

func GetCurrentDhakaTimeDateOnly

func GetCurrentDhakaTimeDateOnly() string

func GetCurrentDhakaTimeObject

func GetCurrentDhakaTimeObject() time.Time

func GetCurrentTime

func GetCurrentTime() string

UTC time functions

func GetCurrentTimeObject

func GetCurrentTimeObject() time.Time

func GetDhakaLocation

func GetDhakaLocation() *time.Location

Dhaka time functions

func GetEnv

func GetEnv(key, defaults string) string

func GetGraphQLObject

func GetGraphQLObject(object interface{}) (*graphql.Object, error)

GetGraphQLObject Converts struct into graphql object

func HandlePayload

func HandlePayload(model *models.ModelType, data map[string]interface{})

func HandleSubPayload

func HandleSubPayload(field *models.FieldInfo, data map[string]interface{})

func HasMetaQuery

func HasMetaQuery(name string) bool

func IntFormat

func IntFormat(v interface{}) (int, error)

func IsInActionNameMap

func IsInActionNameMap(key string) bool

func ModelSchemaBuilder

func ModelSchemaBuilder(modelType *models.ModelType, update bool) *oas.Schema

func MultiLineTextFormat

func MultiLineTextFormat(v interface{}) (map[string]interface{}, error)

func MultipleResourceName

func MultipleResourceName(name string) string

func NewRefreshTokenAuthenticator

func NewRefreshTokenAuthenticator(cfg *models.Config, token string) (*models.JWTTokens, error)

func OpenApiSpecGenerator

func OpenApiSpecGenerator(env string, loader *models.ApplicationCache) (interface{}, error)

func RandomNumberGenerator

func RandomNumberGenerator(min, max int) string

func RandomStringGenerator

func RandomStringGenerator(n int) string

func RandomVariableGenerator

func RandomVariableGenerator(n int) string

func SetTokenClaimsToRouter

func SetTokenClaimsToRouter(ctx echo.Context, tokenClaims *models.TokenClaims) error

func SetTokenCookie

func SetTokenCookie(cfg *models.Config, name, token string, httpOnly bool, expire bool) *http.Cookie

func SingularResourceName

func SingularResourceName(name string) string

func StringContains

func StringContains(arr []string, str string) bool

func ValidatePermissions

func ValidatePermissions(vv map[string]interface{}) (*models.APIPermission, error)

func ValidateScope

func ValidateScope(p string) (*string, bool)

Types

type Authenticator

type Authenticator struct {
	Provider *oidc.Provider
	Config   oauth2.Config
	Ctx      context.Context
}

func NewAuthenticator

func NewAuthenticator(cfg *models.Config) (*Authenticator, error)

type CRUDPermissions

type CRUDPermissions struct {
	Create bool
	Read   bool
	Update bool
	Delete bool
}

type RESTtoGraphResponse

type RESTtoGraphResponse struct {
	Query         string `json:"query"`
	QueryName     string `json:"query_name"`
	OperationName string `json:"operation_name"`
}

func HandleFunctionGraphqlBase

func HandleFunctionGraphqlBase(c echo.Context, schema *models.ProjectSchema, functionName string) (*RESTtoGraphResponse, error)

func RESTtoGraphQL

func RESTtoGraphQL(c echo.Context, schema *models.ProjectSchema, rootModel string, rest url.Values, skipQueryDef bool) (*RESTtoGraphResponse, error)

Jump to

Keyboard shortcuts

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