You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
407 B
29 lines
407 B
package exit |
|
|
|
var defaultOptions = Options{ |
|
Order: 1, |
|
} |
|
|
|
type Options struct { |
|
Order int // 0头部, 1中间, 2尾部 |
|
} |
|
|
|
type Option func(opts *Options) |
|
|
|
func WithOrderFront() Option { |
|
return func(opts *Options) { |
|
opts.Order = 0 |
|
} |
|
} |
|
|
|
func WithOrderMiddle() Option { |
|
return func(opts *Options) { |
|
opts.Order = 1 |
|
} |
|
} |
|
|
|
func WithOrderTail() Option { |
|
return func(opts *Options) { |
|
opts.Order = 2 |
|
} |
|
}
|
|
|