plugins

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2025 License: MIT Imports: 15 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppConfig added in v0.9.0

type AppConfig struct {
	// contains filtered or unexported fields
}

func NewAppConfig added in v0.9.0

func NewAppConfig(plugin *Plugin, app AppLike, set map[string]any) *AppConfig

func (*AppConfig) AddSchemas added in v0.9.0

func (ac *AppConfig) AddSchemas(schemas ...*schema.Schema)

func (*AppConfig) OnPostDBCreate added in v0.9.0

func (ac *AppConfig) OnPostDBCreate(value *qjs.Value) error

func (*AppConfig) OnPostDBDelete added in v0.9.0

func (ac *AppConfig) OnPostDBDelete(value *qjs.Value) error

func (*AppConfig) OnPostDBExec added in v0.9.0

func (ac *AppConfig) OnPostDBExec(value *qjs.Value) error

func (*AppConfig) OnPostDBQuery added in v0.9.0

func (ac *AppConfig) OnPostDBQuery(value *qjs.Value) error

func (*AppConfig) OnPostDBUpdate added in v0.9.0

func (ac *AppConfig) OnPostDBUpdate(value *qjs.Value) error

func (*AppConfig) OnPostResolve added in v0.9.0

func (ac *AppConfig) OnPostResolve(value *qjs.Value) (err error)

func (*AppConfig) OnPreDBCreate added in v0.9.0

func (ac *AppConfig) OnPreDBCreate(value *qjs.Value) error

func (*AppConfig) OnPreDBDelete added in v0.9.0

func (ac *AppConfig) OnPreDBDelete(value *qjs.Value) error

func (*AppConfig) OnPreDBExec added in v0.9.0

func (ac *AppConfig) OnPreDBExec(value *qjs.Value) error

func (*AppConfig) OnPreDBQuery added in v0.9.0

func (ac *AppConfig) OnPreDBQuery(value *qjs.Value) (err error)

func (*AppConfig) OnPreDBUpdate added in v0.9.0

func (ac *AppConfig) OnPreDBUpdate(value *qjs.Value) error

func (*AppConfig) OnPreResolve added in v0.9.0

func (ac *AppConfig) OnPreResolve(value *qjs.Value) (err error)

func (*AppConfig) Set added in v0.9.0

func (ac *AppConfig) Set(config map[string]any) error

type AppLike

type AppLike interface {
	fs.Hookable
	DB() db.Client
	Resources() *fs.ResourcesManager
	Config() *fs.Config
	Logger() logger.Logger
	Dir() string
}

type Builder

type Builder struct {
	// contains filtered or unexported fields
}

func (*Builder) Count added in v0.9.0

func (b *Builder) Count(ctx context.Context) (int, error)

func (*Builder) Create added in v0.9.0

func (b *Builder) Create(ctx context.Context, value map[string]any) (*entity.Entity, error)

func (*Builder) Delete added in v0.9.0

func (b *Builder) Delete(ctx context.Context) (int, error)

func (*Builder) First added in v0.9.0

func (b *Builder) First(ctx context.Context) (*entity.Entity, error)

func (*Builder) Get added in v0.9.0

func (b *Builder) Get(ctx context.Context) ([]*entity.Entity, error)

func (*Builder) Limit added in v0.9.0

func (b *Builder) Limit(limit uint) *Builder

func (*Builder) Offset added in v0.9.0

func (b *Builder) Offset(offset uint) *Builder

func (*Builder) Only added in v0.9.0

func (b *Builder) Only(ctx context.Context) (*entity.Entity, error)

func (*Builder) Select added in v0.9.0

func (b *Builder) Select(fields []string) *Builder

func (*Builder) Update added in v0.9.0

func (b *Builder) Update(ctx context.Context, value map[string]any) ([]*entity.Entity, error)

func (*Builder) Where

func (b *Builder) Where(predicates ...map[string]any) (*Builder, error)

type DB

type DB struct {
	// contains filtered or unexported fields
}

func NewDB

func NewDB(db func() db.Client) *DB

func (*DB) Builder

func (d *DB) Builder(schemaName string) (*Builder, error)

func (*DB) Close added in v0.9.0

func (d *DB) Close() error

func (*DB) Commit

func (d *DB) Commit() error

func (*DB) Create added in v0.9.0

func (d *DB) Create(ctx context.Context, schemaName string, value map[string]any) (*entity.Entity, error)

func (*DB) Exec

func (d *DB) Exec(ctx context.Context, query string, args []any) (sql.Result, error)

func (*DB) Query

func (d *DB) Query(ctx context.Context, query string, args []any) ([]*entity.Entity, error)

func (*DB) Rollback

func (d *DB) Rollback() error

func (*DB) Tx

func (d *DB) Tx(ctx context.Context) (*DB, error)

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

func NewManager

func NewManager(
	app AppLike,
	dir string,
	runtimeSetupFunc func(rt *qjs.Runtime, inPool bool) error,
) (*Manager, error)

func (*Manager) Config

func (m *Manager) Config() error

Config allows plugins to update the app configuration before initialization

func (*Manager) Get added in v0.9.0

func (m *Manager) Get(name string) (*Plugin, bool)

Get returns the plugin by name

func (*Manager) Init

func (m *Manager) Init() error

Init initializes the plugin after the app and Config have been initialized

type Plugin

type Plugin struct {
	// contains filtered or unexported fields
}

func NewPlugin

func NewPlugin(
	app AppLike,
	pluginDir string,
	runtimeSetupFunc func(rt *qjs.Runtime, inPool bool) error,
	qjsWasmBytes []byte,
) (p *Plugin, err error)

NewPlugin creates a new plugin instance

  • app: the fastschema app instance
  • dir: the relative path to the plugin directory

func (*Plugin) Config

func (p *Plugin) Config() (err error)

func (*Plugin) EvalPluginFile added in v0.9.0

func (p *Plugin) EvalPluginFile(rt *qjs.Runtime, inPool bool) (err error)

func (*Plugin) Init

func (p *Plugin) Init() (err error)

func (*Plugin) InvokeJsFunc added in v0.9.0

func (p *Plugin) InvokeJsFunc(jsFuncName string, args ...any) (*qjs.Value, error)

func (*Plugin) Name

func (p *Plugin) Name() string

func (*Plugin) WithJSFuncName added in v0.9.0

func (p *Plugin) WithJSFuncName(v *qjs.Value, cb func(jsFuncName string)) error

type Resource

type Resource struct {
	// contains filtered or unexported fields
}

func NewResource

func NewResource(resource *fs.Resource, plugin *Plugin) *Resource

func (*Resource) Add

func (r *Resource) Add(value *qjs.Value, metas ...*fs.Meta) (*Resource, error)

func (*Resource) Find added in v0.6.0

func (r *Resource) Find(id string) *Resource

func (*Resource) Group

func (r *Resource) Group(name string, metas ...*fs.Meta) *Resource

Jump to

Keyboard shortcuts

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