Restructure based on hello reference

This commit is contained in:
Thomas Boerger
2019-12-06 13:18:26 +01:00
parent ac202d5458
commit dfa78aff7c
53 changed files with 774 additions and 3041 deletions
+19 -5
View File
@@ -4,8 +4,20 @@ import (
"context"
"github.com/owncloud/ocis-graph/pkg/config"
"github.com/owncloud/ocis-pkg/log"
)
// Option defines a single option function.
type Option func(o *Options)
// Options defines the available options for this package.
type Options struct {
Logger log.Logger
Context context.Context
Config *config.Config
}
// newOptions initializes the available default options.
func newOptions(opts ...Option) Options {
opt := Options{}
@@ -16,19 +28,21 @@ func newOptions(opts ...Option) Options {
return opt
}
type Option func(o *Options)
type Options struct {
Context context.Context
Config *config.Config
// Logger provides a function to set the logger option.
func Logger(val log.Logger) Option {
return func(o *Options) {
o.Logger = val
}
}
// Context provides a function to set the context option.
func Context(val context.Context) Option {
return func(o *Options) {
o.Context = val
}
}
// Config provides a function to set the config option.
func Config(val *config.Config) Option {
return func(o *Options) {
o.Config = val