actor

package
v0.0.0-...-93e11d5 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetActor

func SetActor(ctx context.Context, actor Actor) context.Context

Types

type Actor

type Actor struct {
	Type   Type           `bson:"type"   json:"type"`
	Params map[string]any `bson:"params" json:"params"`
}

func GetActor

func GetActor(ctx context.Context) *Actor

func GetActorOrUnknown

func GetActorOrUnknown(ctx context.Context) Actor

func NewExternalCloudAuth

func NewExternalCloudAuth(typ, service string) Actor

func NewExternalLanggraph

func NewExternalLanggraph(userID ksuid.ID) Actor

func NewExternalRevenuecat

func NewExternalRevenuecat() Actor

func NewExternalUser

func NewExternalUser(typ, id, reference string) Actor

func NewInternal

func NewInternal(skip int, codePathFallback string) Actor

NewInternal represents a decision made within your service. Where as service is used to mark a decision made from another service calling in.

The argument skip is the number of stack frames to skip before identifying the frame to use, with 0 identifying the frame for NewInternal itself and 1 identifying the caller of NewInternal.

func NewService

func NewService(env, service string) Actor

func NewSession

func NewSession(sessionID ksuid.ID) Actor

func NewUnknown

func NewUnknown(params map[string]any) Actor

func NewUser

func NewUser(sessionID, userID ksuid.ID) Actor

type Actorer

type Actorer interface {
	Actor(context.Context) *Actor
}

type Type

type Type string
var (
	TypeUnknown            Type = "unknown"
	TypeInternal           Type = "internal"
	TypeService            Type = "service" // Mojo service
	TypeUser               Type = "user"    // Mojo user
	TypeSession            Type = "session"
	TypeExternalCloudAuth  Type = "external_cloud_auth" // non-Mojo system
	TypeExternalUser       Type = "external_user"       // non-Mojo user
	TypeExternalLanggraph  Type = "external_langgraph"
	TypeExternalRevenuecat Type = "external_revenuecat"
)

Jump to

Keyboard shortcuts

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