Skip to content

Commit

Permalink
feat: app
Browse files Browse the repository at this point in the history
  • Loading branch information
liyafei committed Dec 18, 2023
1 parent c4e2018 commit e2661fa
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions app/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,45 @@ type options struct {
stopTimeout time.Duration
deliveries []delivery.Delivery
}

func ID(id string) Option {
return func(o *options) {
o.id = id
}
}

func Name(name string) Option {
return func(o *options) {
o.name = name
}
}

func Version(version string) Option {
return func(o *options) {
o.version = version
}
}

func Metadata(md map[string]string) Option {
return func(o *options) {
o.metadata = md
}
}

func Deliveries(deliveries ...delivery.Delivery) Option {
return func(o *options) {
o.deliveries = deliveries
}
}

func Signal(sigs ...os.Signal) Option {
return func(o *options) {
o.sigs = sigs
}
}

func StopTimeout(t time.Duration) Option {
return func(o *options) {
o.stopTimeout = t
}
}

0 comments on commit e2661fa

Please sign in to comment.