westack

package
v1.8.7 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: MIT Imports: 38 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ValidEmailRegex = regexp.MustCompile(`^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$`)

Functions

func CreateNewToken added in v1.8.3

func CreateNewToken(userIdHex string, UserModel *model.Model, roles []string) (string, error)

func GRPCCallWithBody added in v1.4.1

func GRPCCallWithBody[InputT any, ClientT interface{}, OutputT proto.Message](serviceUrl string, clientConstructor func(cc grpc.ClientConnInterface) ClientT, clientMethod func(ClientT, context.Context, *InputT, ...grpc.CallOption) (OutputT, error), timeoutSeconds ...float32) func(ctx *fiber.Ctx) error

func GRPCCallWithQueryParams added in v1.4.1

func GRPCCallWithQueryParams[InputT any, ClientT interface{}, OutputT proto.Message](serviceUrl string, clientConstructor func(cc grpc.ClientConnInterface) ClientT, clientMethod func(ClientT, context.Context, *InputT, ...grpc.CallOption) (OutputT, error), timeoutSeconds ...float32) func(ctx *fiber.Ctx) error

func GetRoleNames added in v1.8.3

func GetRoleNames(RoleMappingModel *model.Model, userIdHex string, userId primitive.ObjectID) ([]string, error)

func InitAndServe added in v1.3.6

func InitAndServe(options Options, onBoot ...func(app *WeStack))

func SendInternalError added in v1.7.2

func SendInternalError(ctx *fiber.Ctx, err error) error

func UpsertUserRoles added in v1.7.0

func UpsertUserRoles(app *WeStack, userId interface{}, roles []string, eventContext *model.EventContext) error

func UpsertUserWithRoles added in v1.5.48

func UpsertUserWithRoles(app *WeStack, userToUpsert UserWithRoles, eventContext *model.EventContext) (user *model.Instance, err error)

Types

type LoginBody

type LoginBody struct {
	Email    string `json:"email"`
	Password string `json:"password"`
}

type Options added in v1.2.71

type Options struct {
	RestApiRoot       string
	Port              int
	JwtSecretKey      string
	DatasourceOptions *map[string]*datasource.Options
	EnableCompression bool
	CompressionConfig compress.Config

	Logger            wst.ILogger
	DisablePortEnvVar bool
	// contains filtered or unexported fields
}

type UniqueNessRestriction added in v1.8.0

type UniqueNessRestriction struct {
	Code      string
	Message   string
	ErrorName string
}

type UpserRequestBody added in v1.7.0

type UpserRequestBody struct {
	Roles []string `json:"roles"`
}

type UserWithRoles added in v1.5.48

type UserWithRoles struct {
	Username string   `json:"username"`
	Password string   `json:"password"`
	Roles    []string `json:"roles"`
}

type WeStack

type WeStack struct {
	Server  *fiber.App
	Viper   *viper.Viper
	DsViper *viper.Viper
	Options Options
	Bson    wst.BsonOptions
	// contains filtered or unexported fields
}

func New

func New(options ...Options) *WeStack

func (*WeStack) Boot

func (app *WeStack) Boot(customRoutesCallbacks ...func(app *WeStack))

func (*WeStack) FindDatasource added in v1.2.94

func (app *WeStack) FindDatasource(dsName string) (*datasource.Datasource, error)

func (*WeStack) FindModel

func (app *WeStack) FindModel(modelName string) (*model.Model, error)

func (*WeStack) FindModelsWithClass added in v1.5.48

func (app *WeStack) FindModelsWithClass(modelClass string) (foundModels []*model.Model)

func (*WeStack) Logger added in v1.7.2

func (app *WeStack) Logger() wst.ILogger

func (*WeStack) Middleware added in v1.3.6

func (app *WeStack) Middleware(handler fiber.Handler)

func (*WeStack) Start

func (app *WeStack) Start() error

func (*WeStack) Stop added in v1.5.46

func (app *WeStack) Stop() error

Directories

Path Synopsis
lib
v2
lambdas Module

Jump to

Keyboard shortcuts

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