Documentation
¶
Overview ¶
Package happy provides a modular framework for rapid prototyping in Go. With this SDK, developers of all levels can easily bring their ideas to life. Whether you're a hacker or a creator, Package happy has everything you need to tackle your domain problems and create working prototypes or MVPs with minimal technical knowledge and infrastructure planning.
Its modular design enables you to package your commands and services into reusable addons, so you're not locked into any vendor tools. It also fits well into projects where different components are written in different programming languages.
Let Package happy help you bring your projects from concept to reality and make you happy along the way.
Index ¶
- Variables
- func API[API api.Provider](sess *session.Context) (api API, err error)
- func New(c *Settings, extend ...settings.Settings) *app.Main
- func ServiceLoader(sess *session.Context, svcs ...string) *services.ServiceLoader
- type CliSettings
- type DateTimeSettings
- type DevelSettings
- type EngineSettings
- type I18nSettings
- type InstanceSettings
- type LoggingSettings
- type ProfileSettings
- type ServicesSettings
- type Settings
- type StatsSettings
Constants ¶
This section is empty.
Variables ¶
var ErrNotImplemented = errors.New("not implemented")
Functions ¶
func ServiceLoader ¶
func ServiceLoader(sess *session.Context, svcs ...string) *services.ServiceLoader
ServiceLoader is a convenience function to create a new ServiceLoader instance from the services package. It initializes and prepares the specified services for loading using the provided session context, acting as a shorthand for services.NewLoader within the Happy-SDK framework.
Parameters:
- sess: The session context used to configure the service loader.
- svcs: A variadic list of service names or addresses to be loaded and started.
Returns:
- A pointer to a ServiceLoader instance configured to load the specified services.
Example usage:
loader := ServiceLoader(sess, "serviceA", "serviceB")
<-loader.Load()
if err := loader.Err(); err != nil {
log.Fatal("Service loading failed:", err)
}
Types ¶
type CliSettings ¶ added in v0.100.0
type CliSettings struct {
settings.Settings
MainMinArgs settings.Uint `default:"0" desc:"Minimum number of arguments for a application main"`
MainMaxArgs settings.Uint `default:"0" desc:"Maximum number of arguments for a application main"`
WithConfigCmd settings.Bool `default:"false" desc:"Add the config command in the CLI"`
WithI18nCmd settings.Bool `default:"false" desc:"Add the i18n command in the CLI"`
WithGlobalFlags settings.Bool `default:"false" desc:"Add the default global flags automatically in the CLI"`
HideDisabledCommands settings.Bool `default:"false" desc:"Hide disabled commands"`
}
type DateTimeSettings ¶ added in v0.100.0
type DevelSettings ¶ added in v0.100.0
type DevelSettings struct {
AllowProd settings.Bool `default:"false" desc:"Allow set app into production mode when running from source."`
}
Settings for the devel module. These settings are used to configure the behavior of the application when user compiles your application from source or uses go run .
type EngineSettings ¶ added in v0.100.0
type I18nSettings ¶ added in v0.100.0
type I18nSettings struct {
Language settings.String `key:"language,save" default:"en" mutation:"mutable"`
Supported settings.StringSlice `key:"supported"`
}
Settings represents the configuration settings for internationalization. It provides a blueprint for configuring the default language and supported languages for Happy SDK Applications.
type InstanceSettings ¶ added in v0.100.0
type LoggingSettings ¶ added in v0.100.0
type LoggingSettings struct {
Level logging.Level `key:"level,config" default:"info" mutation:"mutable" desc:"logging level"`
WithSource settings.Bool `key:"with_source,config" default:"false" mutation:"once" desc:"Show source location in log messages"`
TimestampFormat settings.String `key:"timeestamp_format,config" default:"15:04:05.000" mutation:"once" desc:"Timestamp format for log messages"`
NoTimestamp settings.Bool `key:"no_timestamp,config" default:"false" mutation:"once" desc:"Do not show timestamps"`
NoSlogDefault settings.Bool `key:"no_slog_default" default:"false" mutation:"once" desc:"Do not set the default slog logger"`
}
type ProfileSettings ¶ added in v0.100.0
type ProfileSettings struct {
// Disabled is used to disable the configuration system. When set to true, the configuration
// system is disabled and single runtime profile is used. This is useful when the application does not
// require user configuration and only uses the default settings.
// All settings below are ignored and set to default values when Disabled is set to true.
Disabled settings.Bool `default:"false" desc:"Disabled presistent user configuration"`
Additional settings.StringSlice `desc:"Additional profiles provided by default."`
Default settings.String `default:"default" mutation:"once" desc:"Default profile to use when no profile is specified."`
AllowCustom settings.Bool `default:"false" desc:"Are creation of custom profiles allowed."`
// EnableProfileDevel enables profile development mode. This mode allows different settings
// for development and release versions for a named profile. When this flag is set to true,
// a profile named "default" will also have a corresponding "default-devel" profile.
//
// In development mode (e.g., when using `go run` or a locally compiled binary), the "-devel"
// profile is used. In release mode, the standard profile is used.
//
// If application Devel.AllowProd is set to true, this behavior can be overridden by using
// the -x-prod flag, which is added by the devel package when the AllowProd option is enabled.
// This allows to load the standard profile even when running in development mode e.g. go run.
EnableDevel settings.Bool `default:"false" desc:"Enable profile development mode."`
}
type ServicesSettings ¶ added in v0.100.0
type Settings ¶ added in v0.11.0
type Settings struct {
// Appication info
Name settings.String `key:"app.name" default:"Happy Prototype" desc:"Application name"`
Slug settings.String `key:"app.slug" default:"" desc:"Application slug"`
Identifier settings.String `key:"app.identifier" desc:"Application identifier"`
Description settings.String `key:"app.description" desc:"Application description" i18n:"true"`
CopyrightBy settings.String `key:"app.copyright_by" default:"Anonymous" desc:"Application author"`
CopyrightSince settings.Uint `key:"app.copyright_since" default:"0" desc:"Application copyright since"`
License settings.String `key:"app.license" default:"NOASSERTION" desc:"Application license"`
// Application settings
Engine EngineSettings `key:"app.engine"`
CLI CliSettings `key:"app.cli"`
Profiles ProfileSettings `key:"app.profiles"`
DateTime DateTimeSettings `key:"app.datetime"`
Instance InstanceSettings `key:"app.instance"`
Logging LoggingSettings `key:"app.logging"`
Services ServicesSettings `key:"app.services"`
Stats StatsSettings `key:"app.stats"`
Devel DevelSettings `key:"app.devel"`
I18n I18nSettings `key:"app.i18n"`
// contains filtered or unexported fields
}
func (*Settings) GetFallbackLanguage ¶ added in v0.100.0
type StatsSettings ¶ added in v0.100.0
Directories
¶
| Path | Synopsis |
|---|---|
|
addons
|
|
|
third-party/github
module
|
|
|
cmd
|
|
|
hap
module
|
|
|
examples
|
|
|
addons/hello
SPDX-License-Identifier: Apache-2.0
|
SPDX-License-Identifier: Apache-2.0 |
|
apps/basic
command
SPDX-License-Identifier: Apache-2.0
|
SPDX-License-Identifier: Apache-2.0 |
|
apps/hello
command
SPDX-License-Identifier: Apache-2.0
|
SPDX-License-Identifier: Apache-2.0 |
|
apps/minimal
command
SPDX-License-Identifier: Apache-2.0
|
SPDX-License-Identifier: Apache-2.0 |
|
apps/showcase
command
SPDX-License-Identifier: Apache-2.0
|
SPDX-License-Identifier: Apache-2.0 |
|
internal
|
|
|
cmd/hap
module
|
|
|
pkg
|
|
|
bitutils
module
|
|
|
branding
module
|
|
|
bytesize
module
|
|
|
cli/ansicolor
module
|
|
|
devel/goutils
module
|
|
|
devel/testutils
module
|
|
|
fsutils
module
|
|
|
i18n
module
|
|
|
logging
module
|
|
|
logging/adapters/console
module
|
|
|
networking
module
|
|
|
options
module
|
|
|
platform/daemon
module
|
|
|
scheduling/cron
module
|
|
|
settings
module
|
|
|
strings/bexp
module
|
|
|
strings/humanize
module
|
|
|
strings/slug
module
|
|
|
strings/textfmt
module
|
|
|
tui
module
|
|
|
vars
module
|
|
|
version
module
|
|
|
sdk
|
|
|
cli
Package cli provides utilities for happy command line interfaces.
|
Package cli provides utilities for happy command line interfaces. |
|
internal/cmd/hsdk
module
|
|
|
tools
|
|
|
happy-sdk/cmd/happy-sdk
command
|
|