Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
408 changed files
with
140,305 additions
and
2,727 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package picfit | ||
|
||
// Option is a functional option. | ||
type Option func(*Options) | ||
|
||
// Options are server options. | ||
type Options struct { | ||
Async bool | ||
Load bool | ||
} | ||
|
||
// NewOptions initializes server options. | ||
func newOptions(opts ...Option) Options { | ||
opt := Options{} | ||
for _, o := range opts { | ||
o(&opt) | ||
} | ||
return opt | ||
} | ||
|
||
// WithAsync overrides async value. | ||
func WithAsync(async bool) Option { | ||
return func(o *Options) { | ||
o.Async = async | ||
} | ||
} | ||
|
||
// WithLoad overrides load value. | ||
func WithLoad(load bool) Option { | ||
return func(o *Options) { | ||
o.Load = load | ||
} | ||
} |
Oops, something went wrong.