Documentation

Index

Constants

View Source
const (
	LogKeyAccesslog         LogKey = "accesslog" // LogKeyAccesslog marks a logmessage belonging to an (incoming) call (value should be 1)
	LogKeyApicall                  = "apicall"   // LogKeyApicall marks a logmessage belonging to an (outgoing) api call (value should be 1)
	LogKeyArea                     = "area"
	LogKeyBusinessID               = "businessId"
	LogKeyCategory                 = "category"
	LogKeyModule                   = "module"
	LogKeySubCategory              = "sub_category"
	LogKeyClientIP                 = "client_ip"
	LogKeyCode                     = "code"
	LogKeyConnectionStatus         = "connection_status"
	LogKeyCorrelationID            = "correlationId"
	LogKeyTraceID                  = "traceID"
	LogKeySpanID                   = "spanID"
	LogKeyLevel                    = "level"
	LogKeyMessage                  = "message"
	LogKeyMethod                   = "method"
	LogKeySession                  = "session"
	LogKeyPath                     = "path"
	LogKeyReferer                  = "referer"
	LogKeyRequest                  = "request"
	LogKeyRequestTime              = "request_time"
	LogKeyRequestedEndpoint        = "requested_endpoint"
	LogKeyRequestedURL             = "requested_url"
	LogKeyResponse                 = "response"
	LogKeyResponseCode             = "response_code"
	LogKeyResponseTime             = "response_time"
	LogKeySource                   = "source"
	LogKeyTimestamp                = "@timestamp"
	LogKeyTrace                    = "trace"
)

    Common logger field keys

    Variables

    This section is empty.

    Functions

    func AppVersion

    func AppVersion() string

      AppVersion returns the application version set this during build with `go build -ldflags "-X flamingo.me/flamingo/v3/framework/flamingo.appVersion=1.2.3"`.

      func BindEventSubscriber

      func BindEventSubscriber(injector *dingo.Injector) *dingo.Binding

        BindEventSubscriber is a helper to bind a private event Subscriber via Dingo

        func BindTemplateFunc

        func BindTemplateFunc(injector *dingo.Injector, name string, fnc TemplateFunc)

          BindTemplateFunc makes sure a template function is correctly bound via dingo

          Types

          type DefaultEventRouter

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

            DefaultEventRouter is a default event routing implementation

            func (*DefaultEventRouter) Dispatch

            func (d *DefaultEventRouter) Dispatch(ctx context.Context, event Event)

              Dispatch calls the event's Dispatch method on each subscriber

              func (*DefaultEventRouter) Inject

              func (d *DefaultEventRouter) Inject(provider eventSubscriberProvider, logger Logger)

                Inject eventSubscriberProvider dependency

                type Event

                type Event interface{}

                  Event defines some event

                  type EventRouter

                  type EventRouter interface {
                  	Dispatch(ctx context.Context, event Event)
                  }

                    EventRouter routes events

                    type LogKey

                    type LogKey string

                      LogKey is a logging key constant

                      type Logger

                      type Logger interface {
                      	WithContext(ctx context.Context) Logger
                      
                      	Debug(args ...interface{})
                      	Info(args ...interface{})
                      	Warn(args ...interface{})
                      	Error(args ...interface{})
                      	Fatal(args ...interface{})
                      	Panic(args ...interface{})
                      
                      	Debugf(log string, args ...interface{})
                      
                      	WithField(key LogKey, value interface{}) Logger
                      	WithFields(fields map[LogKey]interface{}) Logger
                      
                      	Flush()
                      }

                        Logger defines a standard Flamingo logger interfaces

                        type NullLogger

                        type NullLogger struct{}

                          NullLogger does not log

                          func (NullLogger) Debug

                          func (NullLogger) Debug(args ...interface{})

                            Debug null-implementation

                            func (NullLogger) Debugf

                            func (NullLogger) Debugf(log string, args ...interface{})

                              Debugf null-implementation

                              func (NullLogger) Error

                              func (NullLogger) Error(args ...interface{})

                                Error null-implementation

                                func (NullLogger) Fatal

                                func (NullLogger) Fatal(args ...interface{})

                                  Fatal null-implementation

                                  func (NullLogger) Flush

                                  func (n NullLogger) Flush()

                                    Flush null-implementation

                                    func (NullLogger) Info

                                    func (NullLogger) Info(args ...interface{})

                                      Info null-implementation

                                      func (NullLogger) Panic

                                      func (NullLogger) Panic(args ...interface{})

                                        Panic null-implementation

                                        func (NullLogger) Warn

                                        func (NullLogger) Warn(args ...interface{})

                                          Warn null-implementation

                                          func (NullLogger) WithContext

                                          func (n NullLogger) WithContext(ctx context.Context) Logger

                                            WithContext null-implementation

                                            func (NullLogger) WithField

                                            func (n NullLogger) WithField(key LogKey, value interface{}) Logger

                                              WithField null-implementation

                                              func (NullLogger) WithFields

                                              func (n NullLogger) WithFields(fields map[LogKey]interface{}) Logger

                                                WithFields null-implementation

                                                type PartialTemplateEngine

                                                type PartialTemplateEngine interface {
                                                	RenderPartials(ctx context.Context, templateName string, data interface{}, partials []string) (map[string]io.Reader, error)
                                                }

                                                  PartialTemplateEngine is used for progressive enhancements / rendering of partial template areas usually this is requested via the appropriate javascript headers and taken care of in the framework renderer

                                                  type ServerShutdownEvent

                                                  type ServerShutdownEvent struct{}

                                                    ServerShutdownEvent is dispatched when a server is stopped (not for CLI commands)

                                                    type ServerStartEvent

                                                    type ServerStartEvent struct {
                                                    	Port string
                                                    }

                                                      ServerStartEvent is dispatched when a server is started (not for CLI commands)

                                                      type SessionModule

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

                                                        SessionModule for session management

                                                        func (*SessionModule) Configure

                                                        func (m *SessionModule) Configure(injector *dingo.Injector)

                                                          Configure DI

                                                          func (*SessionModule) CueConfig

                                                          func (*SessionModule) CueConfig() string

                                                            CueConfig defines the session config scheme

                                                            func (*SessionModule) FlamingoLegacyConfigAlias

                                                            func (m *SessionModule) FlamingoLegacyConfigAlias() map[string]string

                                                              FlamingoLegacyConfigAlias maps legacy config to new

                                                              func (*SessionModule) Inject

                                                              func (m *SessionModule) Inject(config *struct {
                                                              	// session config is optional to allow usage of the DefaultConfig
                                                              	Backend  string `inject:"config:flamingo.session.backend"`
                                                              	Secret   string `inject:"config:flamingo.session.secret"`
                                                              	FileName string `inject:"config:flamingo.session.file"`
                                                              	Secure   bool   `inject:"config:flamingo.session.cookie.secure"`
                                                              	// float64 is used due to the injection as config from json - int is not possible on this
                                                              	StoreLength          float64 `inject:"config:flamingo.session.store.length"`
                                                              	MaxAge               float64 `inject:"config:flamingo.session.max.age"`
                                                              	Path                 string  `inject:"config:flamingo.session.cookie.path"`
                                                              	RedisURL             string  `inject:"config:flamingo.session.redis.url"`
                                                              	RedisHost            string  `inject:"config:flamingo.session.redis.host"`
                                                              	RedisPassword        string  `inject:"config:flamingo.session.redis.password"`
                                                              	RedisIdleConnections float64 `inject:"config:flamingo.session.redis.idle.connections"`
                                                              	RedisMaxAge          float64 `inject:"config:flamingo.session.redis.maxAge"`
                                                              	RedisDatabase        string  `inject:"config:flamingo.session.redis.database,optional"`
                                                              	CheckSession         bool    `inject:"config:flamingo.session.healthcheck,optional"`
                                                              })

                                                                Inject dependencies

                                                                type ShutdownEvent

                                                                type ShutdownEvent struct{}

                                                                  ShutdownEvent is dispatched when the application shuts down

                                                                  type StartupEvent

                                                                  type StartupEvent struct{}

                                                                    StartupEvent is dispatched when the application starts

                                                                    type StdLogger

                                                                    type StdLogger struct {
                                                                    	log.Logger
                                                                    }

                                                                      StdLogger uses the go stdlib logger for logging

                                                                      func (*StdLogger) Debug

                                                                      func (l *StdLogger) Debug(args ...interface{})

                                                                        Debug logs output

                                                                        func (*StdLogger) Debugf

                                                                        func (l *StdLogger) Debugf(f string, args ...interface{})

                                                                          Debugf outputs the formatted debug string

                                                                          func (*StdLogger) Error

                                                                          func (l *StdLogger) Error(args ...interface{})

                                                                            Error log

                                                                            func (*StdLogger) Flush

                                                                            func (l *StdLogger) Flush()

                                                                              Flush does nothing

                                                                              func (*StdLogger) Info

                                                                              func (l *StdLogger) Info(args ...interface{})

                                                                                Info log output

                                                                                func (*StdLogger) Warn

                                                                                func (l *StdLogger) Warn(args ...interface{})

                                                                                  Warn log output

                                                                                  func (*StdLogger) WithContext

                                                                                  func (l *StdLogger) WithContext(ctx context.Context) Logger

                                                                                    WithContext currently does nothing

                                                                                    func (*StdLogger) WithField

                                                                                    func (l *StdLogger) WithField(key LogKey, value interface{}) Logger

                                                                                      WithField currently logs the field

                                                                                      func (*StdLogger) WithFields

                                                                                      func (l *StdLogger) WithFields(fields map[LogKey]interface{}) Logger

                                                                                        WithFields currently logs the fields

                                                                                        type TemplateEngine

                                                                                        type TemplateEngine interface {
                                                                                        	Render(context context.Context, name string, data interface{}) (io.Reader, error)
                                                                                        }

                                                                                          TemplateEngine defines the basic template engine

                                                                                          type TemplateFunc

                                                                                          type TemplateFunc interface {
                                                                                          	Func(ctx context.Context) interface{}
                                                                                          }

                                                                                            TemplateFunc defines an interface for a custom function to be used in gotemplates/pug templates

                                                                                            Directories

                                                                                            Path Synopsis