pocketbase
import pocketbase "ganigeorgiev.com/pocketbase/pocketbase"
Source: ..
Constants
const (
// ModerncDepsCheckHookId is the id of the hook that performs the modernc.org/* deps checks.
// It could be used for removing/unbinding the hook if you don't want the checks.
ModerncDepsCheckHookId = "pbModerncDepsCheck"
)
Variables
var Version = "(untracked)"
Version of PocketBase
Types
Config
type Config struct {
// hide the default console server info on app startup
HideStartBanner bool
// optional default values for the console flags
DefaultDev bool
DefaultDataDir string // if not set, it will fallback to "./pb_data"
DefaultEncryptionEnv string
DefaultQueryTimeout time.Duration // default to core.DefaultQueryTimeout (in seconds)
// optional DB configurations
DataMaxOpenConns int // default to core.DefaultDataMaxOpenConns
DataMaxIdleConns int // default to core.DefaultDataMaxIdleConns
AuxMaxOpenConns int // default to core.DefaultAuxMaxOpenConns
AuxMaxIdleConns int // default to core.DefaultAuxMaxIdleConns
DBConnect core.DBConnectFunc // default to core.dbConnect
}
Config is the PocketBase initialization config struct.
PocketBase
type PocketBase struct {
core.App
// RootCmd is the main console command
RootCmd *cobra.Command
// contains filtered or unexported fields
}
PocketBase defines a PocketBase app launcher.
It implements core.App via embedding and all of the app interface methods could be accessed directly through the instance (eg. PocketBase.DataDir()).
New
func New() *PocketBase
New creates a new PocketBase instance with the default configuration. Use NewWithConfig if you want to provide a custom configuration.
Note that the application will not be initialized/bootstrapped yet, aka. DB connections, migrations, app settings, etc. will not be accessible. Everything will be initialized when PocketBase.Start is executed. If you want to initialize the application before calling PocketBase.Start, then you'll have to manually call [PocketBase.Bootstrap].
NewWithConfig
func NewWithConfig(config Config) *PocketBase
NewWithConfig creates a new PocketBase instance with the provided config.
Note that the application will not be initialized/bootstrapped yet, aka. DB connections, migrations, app settings, etc. will not be accessible. Everything will be initialized when PocketBase.Start is executed. If you want to initialize the application before calling PocketBase.Start, then you'll have to manually call [PocketBase.Bootstrap].
PocketBase.Execute
func (pb *PocketBase) Execute() error
Execute initializes the application (if not already) and executes the pb.RootCmd with graceful shutdown support.
This method differs from pb.Start() by not registering the default system commands!
PocketBase.Start
func (pb *PocketBase) Start() error
Start starts the application, aka. registers the default system commands (serve, superuser, version) and executes pb.RootCmd.
Questions and comments
Comments are a GitHub Discussions thread; sign in with GitHub to post.