Commit 0e161b7d authored by Dustin L. Howett's avatar Dustin L. Howett
Browse files

Add options.go, which I forgot.

parent a10255a6
package views
import (
// ModelOption represents a functional option for configuring a View
// Model.
type ModelOption func(*Model) error
// GlobalDataProviderOption binds the `global` template function to the
// supplied data provider.
func GlobalDataProviderOption(provider DataProvider) ModelOption {
return func(m *Model) error {
"global": varFromDataProvider(provider),
return nil
// GlobalFunctionsOption binds the template functions yielded by the
// supplied function provider.
func GlobalFunctionsOption(provider FunctionProvider) ModelOption {
return func(m *Model) error {
return nil
// FieldLoggingOption enables logging to a logrus-enabled stream.
func FieldLoggingOption(logger logrus.FieldLogger) ModelOption {
return func(m *Model) error {
m.logger = logger
return nil
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment