Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Version = "(untracked)"
Version of PostgreBase
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// optional default values for the console flags
DefaultDebug bool
DefaultDataDir string // if not set, it will fallback to "./pb_data"
DefaultDataDsn string // if not set, it will fallback to "sqlite://pb_data/data.db"
RedisDsn string //redis://<user>:<pass>@localhost:6379/<db>
DefaultEncryptionEnv string
DisableVector bool
ClusterPeers []string
NodeAddr string
NodeID string
// hide the default console server info on app startup
HideStartBanner bool
// optional DB configurations
DataMaxOpenConns int // default to core.DefaultDataMaxOpenConns
DataMaxIdleConns int // default to core.DefaultDataMaxIdleConns
LogsMaxOpenConns int // default to core.DefaultLogsMaxOpenConns
LogsMaxIdleConns int // default to core.DefaultLogsMaxIdleConns
}
Config is the PostgreBase initialization config struct.
type PostgreBase ¶ added in v0.0.4
type PostgreBase struct {
// RootCmd is the main console command
RootCmd *cobra.Command
// contains filtered or unexported fields
}
PostgreBase defines a PostgreBase app launcher.
It implements core.App via embedding and all of the app interface methods could be accessed directly through the instance (eg. PostgreBase.DataDir()).
func New ¶
func New() *PostgreBase
New creates a new PostgreBase 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 [Start()] is executed. If you want to initialize the application before calling [Start()], then you'll have to manually call [Bootstrap()].
func NewWithConfig ¶
func NewWithConfig(config Config) *PostgreBase
NewWithConfig creates a new PostgreBase 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 [Start()] is executed. If you want to initialize the application before calling [Start()], then you'll have to manually call [Bootstrap()].
func (*PostgreBase) Execute ¶ added in v0.0.4
func (pb *PostgreBase) 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!
func (*PostgreBase) Start ¶ added in v0.0.4
func (pb *PostgreBase) Start() error
Start starts the application, aka. registers the default system commands (serve, migrate, version) and executes pb.RootCmd.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package apis implements the default PostgreBase api services and middlewares.
|
Package apis implements the default PostgreBase api services and middlewares. |
|
Package core is the backbone of PostgreBase.
|
Package core is the backbone of PostgreBase. |
|
Package daos handles common PostgreBase DB model manipulations.
|
Package daos handles common PostgreBase DB model manipulations. |
|
Package dbx provides a set of DB-agnostic and easy-to-use query building methods for relational databases.
|
Package dbx provides a set of DB-agnostic and easy-to-use query building methods for relational databases. |
|
Package models implements various services used for request data validation and applying changes to existing DB models through the app Dao.
|
Package models implements various services used for request data validation and applying changes to existing DB models through the app Dao. |
|
validators
Package validators implements custom shared PostgreBase validators.
|
Package validators implements custom shared PostgreBase validators. |
|
Package mails implements various helper methods for sending user and admin emails like forgotten password, verification, etc.
|
Package mails implements various helper methods for sending user and admin emails like forgotten password, verification, etc. |
|
Package mcp implements the Model Context Protocol server for PostgreBase.
|
Package mcp implements the Model Context Protocol server for PostgreBase. |
|
Package migrations contains the system PostgreBase DB migrations.
|
Package migrations contains the system PostgreBase DB migrations. |
|
Package models implements all PostgreBase DB models and DTOs.
|
Package models implements all PostgreBase DB models and DTOs. |
|
schema
Package schema implements custom Schema and SchemaField datatypes for handling the Collection schema definitions.
|
Package schema implements custom Schema and SchemaField datatypes for handling the Collection schema definitions. |
|
Package resolvers contains custom search.FieldResolver implementations.
|
Package resolvers contains custom search.FieldResolver implementations. |
|
Package tokens implements various user and admin tokens generation methods.
|
Package tokens implements various user and admin tokens generation methods. |
|
tools
|
|
|
cron
Package cron implements a crontab-like service to execute and schedule repeative tasks/jobs.
|
Package cron implements a crontab-like service to execute and schedule repeative tasks/jobs. |
|
template
Package template is a thin wrapper around the standard html/template and text/template packages that implements a convenient registry to load and cache templates on the fly concurrently.
|
Package template is a thin wrapper around the standard html/template and text/template packages that implements a convenient registry to load and cache templates on the fly concurrently. |
|
tokenizer
Package tokenizer implements a rudimentary tokens parser of buffered io.Reader while respecting quotes and parenthesis boundaries.
|
Package tokenizer implements a rudimentary tokens parser of buffered io.Reader while respecting quotes and parenthesis boundaries. |
|
types
Package types implements some commonly used db serializable types like datetime, json, etc.
|
Package types implements some commonly used db serializable types like datetime, json, etc. |
|
Package ui handles the PostgreBase Admin frontend embedding.
|
Package ui handles the PostgreBase Admin frontend embedding. |