created_by

package module
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2025 License: MIT Imports: 6 Imported by: 0

README

Created By

An xpb plugin for Pocketbase that allows for easily configured created_by fields.

Configure single relation fields to auth collections to be automatically set to the auth record of the user making the post request.

Installation

  1. Install XPB.
  2. Use the builder:
xpb build --with github.com/pocketbuilds/created_by@latest

Setup

  1. Create a single relation field to the auth collection.
  2. Add the field to the plugin config.
  3. Restart the pocketbase app.

Plugin Config

# pocketbuilds.toml

[created_by]
# Array of single relation fields to auth collections to
#   automatically set on record create.
#   - format: "<collection_name>.<field_name>"
fields = [
  "my_collection.created_by",
  "posts.authored_by",
  "messages.user_id",
  # etc...
]

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Plugin

type Plugin struct {
	// Single relation fields to auth collections to
	//   automatically set on record create in the
	//   format "collection.field_name".
	Fields []string `json:"fields"`
}

func (*Plugin) Description

func (p *Plugin) Description() string

Description implements xpb.Plugin.

func (*Plugin) Init

func (p *Plugin) Init(app core.App) error

Init implements xpb.Plugin.

func (*Plugin) Name

func (p *Plugin) Name() string

Name implements xpb.Plugin.

func (*Plugin) Validate

func (p *Plugin) Validate() error

Validate implements validation.Validatable.

func (*Plugin) Version

func (p *Plugin) Version() string

Version implements xpb.Plugin.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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