engine

package module
v0.0.624 Latest Latest
Warning

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

Go to latest
Published: May 2, 2026 License: Apache-2.0 Imports: 34 Imported by: 5

README

Engine 📦

Fabriktor Logo

GitLab stars

Go Reference License Go Report Card Pipeline Badge

Overview

This package is designed exclusively for Fabriktor's operational needs and is not intended for public usage.

Refer to the Go Reference for detailed API documentation and examples.

License

This project is licensed under the Apache License 2.0.

Documentation

Index

Constants

View Source
const SepNotifUserIDs = ","

Variables

This section is empty.

Functions

func DeleteMany added in v0.0.6

DeleteMany handles a delete-many operation using query parameters and a transaction.

func DeleteOne added in v0.0.6

DeleteOne handles a delete-one operation using a transaction.

func FetchBill added in v0.0.605

func FetchBill(ctx context.Context, opts FetchBillOptions) (*bill.Bill, error)

func FetchBills added in v0.0.608

func FetchBills(ctx context.Context, opts FetchBillsOptions) ([]*bill.Bill, error)

func FetchPrefCompany added in v0.0.616

func FetchPrefCompany(ctx context.Context, opts FetchPrefOptions) (*prefcompany.PrefCompany, error)

func FetchPrefLanguage added in v0.0.595

func FetchPrefLanguage(ctx context.Context, opts FetchPrefOptions) (*preflanguage.PrefLanguage, error)

func FetchPrefPayment added in v0.0.609

func FetchPrefPayment(ctx context.Context, opts FetchPrefOptions) (*prefpayment.PrefPayment, error)

func FetchUser added in v0.0.598

func FetchUser(ctx context.Context, opts FetchUserOptions) (*user.User, error)

func FindMany added in v0.0.6

FindMany handles a find-many operation using a transaction.

func FindOne added in v0.0.6

FindOne handles a find-one operation using a transaction.

func HDeleteMany added in v0.0.562

HDeleteMany contains the inner logic for a delete-many operation.

func HDeleteOne added in v0.0.116

HDeleteOne contains the inner logic for a delete-one operation.

func HInsertOne added in v0.0.116

HInsertOne contains the inner logic for an insert-one operation.

func HPull added in v0.0.428

func HReplaceOne added in v0.0.116

HReplaceOne contains the inner logic for a replace-one operation.

func HSearchMany added in v0.0.116

HSearchMany contains the inner logic for a search-many operation.

func HUpsertOne added in v0.0.385

HUpsertOne contains the inner logic for an upsert-one operation.

func InsertOne added in v0.0.6

InsertOne handles an insert-one operation using a transaction.

func NoContent added in v0.0.561

func NoContent(t *toolbox.Toolbox) contract.HandlerFunc

NoContent handles a no-content operation.

func NotFound added in v0.0.6

func NotFound(t *toolbox.Toolbox) contract.HandlerFunc

NotFound handles a not-found operation.

func Pull added in v0.0.428

Pull handles a pull operation for vector matching within a session.

func Query added in v0.0.104

Query handles a find-many operation using query parameters and a transaction.

func RecsToAny added in v0.0.115

func RecsToAny(v []Record) []any

RecsToAny converts a slice of Records to a slice of any.

func RecsToIdtfs added in v0.0.115

func RecsToIdtfs(v []Record) []contract.Identifiable

RecsToIdtfs converts a slice of Records to Identifiables.

func RecsToPullSessions added in v0.0.428

func RecsToPullSessions(v []Record) ([]contract.PullSession, error)

RecsToPullSessions converts a slice of Records to PullSessions.

func ReplaceOne added in v0.0.6

ReplaceOne handles a replace-one operation using a transaction.

func SearchMany added in v0.0.6

SearchMany handles a search-many operation.

func SendEmail added in v0.0.591

func SendEmail(ctx context.Context, opts SendEmailOptions) error

SendEmail publishes an email using provided or fetched user documents.

func SendExternalEmail added in v0.0.619

func SendExternalEmail(ctx context.Context, opts SendExternalEmailOptions) error

SendExternalEmail publishes an email directly to an external recipient without user lookup.

func SendNotif added in v0.0.597

func SendNotif(ctx context.Context, opts SendNotifOptions) error

SendNotif publishes a notification request to PubSub.

func Swagger added in v0.0.6

func Swagger(t *toolbox.Toolbox) contract.HandlerFunc

Swagger serves the Redoc UI for API docs.

func SwaggerR added in v0.0.10

func SwaggerR(t *toolbox.Toolbox) contract.HandlerFunc

SwaggerR serves the raw Swagger file.

func UpsertOne added in v0.0.385

UpsertOne handles an upsert-one operation using a transaction.

Types

type CleanFunc added in v0.0.410

type CleanFunc func(ctx context.Context, t *toolbox.Toolbox, opts CleanOptions) (Record, error)

func CleanAs added in v0.0.410

func CleanAs[T any](fn func(*T) error) CleanFunc

CleanAs adapts a typed pointer mutator into a CleanFunc (no-op for non-matching types).

type CleanOption added in v0.0.410

type CleanOption = contract.Opt[CleanOptions]

func WithCleanRecord added in v0.0.410

func WithCleanRecord(x Record) CleanOption

func WithCleanRequest added in v0.0.410

func WithCleanRequest(x *http.Request) CleanOption

func WithCleanVars added in v0.0.411

func WithCleanVars(x *configpkg.Vars) CleanOption

type CleanOptions added in v0.0.410

type CleanOptions struct {
	R    *http.Request
	V    Record
	Vars *configpkg.Vars
}

func ApplyCleanOptions added in v0.0.410

func ApplyCleanOptions(opts *CleanOptions, modifiers ...CleanOption) CleanOptions

type Cleaners added in v0.0.410

type Cleaners []CleanFunc

type Client

type Client interface {
	Start(ctx context.Context) error
	Stop(ctx context.Context) error
	PurgeTestDB(ctx context.Context) error
}

func NewEngine

func NewEngine(opts ClientOptions) (Client, error)

type ClientOption

type ClientOption = contract.Opt[ClientOptions]

func WithNotFoundHandler added in v0.0.164

func WithNotFoundHandler(x contract.HandlerFunc) ClientOption

func WithPurgeTestDBOptions added in v0.0.201

func WithPurgeTestDBOptions(x []contract.CreateCollectionsOptions) ClientOption

func WithRoutes added in v0.0.6

func WithRoutes(x []*contract.Route) ClientOption

func WithToolbox

func WithToolbox(x *toolbox.Toolbox) ClientOption

type ClientOptions

type ClientOptions struct {
	T               *toolbox.Toolbox
	R               []*contract.Route
	NotFoundHandler contract.HandlerFunc
	P               []contract.CreateCollectionsOptions
}

func ApplyClientOptions

func ApplyClientOptions(opts *ClientOptions, modifiers ...ClientOption) ClientOptions

type CollateralFunc added in v0.0.260

type CollateralFunc func(ctx context.Context, t *toolbox.Toolbox, opts CollateralOptions) error

type CollateralOption added in v0.0.260

type CollateralOption = contract.Opt[CollateralOptions]

func WithCollateralRecord added in v0.0.261

func WithCollateralRecord(x Record) CollateralOption

func WithCollateralRequest added in v0.0.260

func WithCollateralRequest(x *http.Request) CollateralOption

type CollateralOptions added in v0.0.260

type CollateralOptions struct {
	R *http.Request
	V Record
}

func ApplyCollateralOptions added in v0.0.260

func ApplyCollateralOptions(opts *CollateralOptions, modifiers ...CollateralOption) CollateralOptions

type Collaterals added in v0.0.260

type Collaterals []CollateralFunc

Collaterals always run after the handler finishes its normal DB/write cycle. To write again, do it inside the collateral.

type Computable added in v0.0.215

type Computable interface {
	Compute(ctx context.Context, opts ComputeOptions) error
}

type ComputeOption added in v0.0.259

type ComputeOption = contract.Opt[ComputeOptions]

func WithComputeMethod added in v0.0.259

func WithComputeMethod(x string) ComputeOption

func WithComputeRequest added in v0.0.259

func WithComputeRequest(x *http.Request) ComputeOption

func WithComputeToolbox added in v0.0.259

func WithComputeToolbox(x *toolbox.Toolbox) ComputeOption

type ComputeOptions added in v0.0.259

type ComputeOptions struct {
	T      *toolbox.Toolbox
	R      *http.Request
	Method string
}

func ApplyComputeOptions added in v0.0.259

func ApplyComputeOptions(opts *ComputeOptions, modifiers ...ComputeOption) ComputeOptions

type FetchBillOptions added in v0.0.605

type FetchBillOptions struct {
	T                      *toolbox.Toolbox
	R                      *http.Request
	BillID                 *contract.ID
	AuthenticateWithSecret bool
}

type FetchBillsOptions added in v0.0.608

type FetchBillsOptions struct {
	T                      *toolbox.Toolbox
	R                      *http.Request
	Query                  map[string][]string
	AuthenticateWithSecret bool
}

type FetchPrefOptions added in v0.0.609

type FetchPrefOptions struct {
	T                      *toolbox.Toolbox
	R                      *http.Request
	OwnerID                *contract.ID
	AuthenticateWithSecret bool
}

type FetchUserOptions added in v0.0.598

type FetchUserOptions struct {
	T                      *toolbox.Toolbox
	R                      *http.Request
	UserID                 *contract.ID
	AuthenticateWithSecret bool
}

type Record added in v0.0.7

func HFindMany added in v0.0.116

HFindMany contains the inner logic for a find-many operation.

func HFindOne added in v0.0.116

HFindOne contains the inner logic for a find-one operation.

func IdtfsToRecs added in v0.0.115

func IdtfsToRecs(v []contract.Identifiable) ([]Record, error)

IdtfsToRecs converts a slice of Identifiables to Records.

func ToRec added in v0.0.115

func ToRec(v any) (Record, error)

ToRec asserts a value to a Record.

func ToRecs added in v0.0.115

func ToRecs(v []any) ([]Record, error)

ToRecs converts a slice of any to a slice of Records.

type SendEmailOptions added in v0.0.591

type SendEmailOptions struct {
	R      *http.Request
	T      *toolbox.Toolbox
	TMPL   contract.EmailTemplateType
	S      contract.EmailSpecifics
	PL     *preflanguage.PrefLanguage
	U      *user.User
	UserID string
}

SendEmailOptions defines inputs for sending an email. PL and U may be nil (they will be fetched), but if either is nil, UserID must be provided to allow fetching.

type SendExternalEmailOptions added in v0.0.619

type SendExternalEmailOptions struct {
	R                 *http.Request
	T                 *toolbox.Toolbox
	TMPL              contract.EmailTemplateType
	S                 contract.EmailSpecifics
	RecipientLanguage string
	RecipientEmail    string
	RecipientName     string
}

type SendNotifOptions added in v0.0.597

type SendNotifOptions struct {
	T               *toolbox.Toolbox
	UserIDs         []*contract.ID
	NotifK          contract.NotifK
	EnglishTitle    string
	EnglishBody     string
	PathCustomImage string
	URLCustomSound  string
	CustomData      map[string]string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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