Skip to content

Commit

Permalink
Merge pull request #21 from horockey/dev
Browse files Browse the repository at this point in the history
refactor: using external opts
  • Loading branch information
horockey authored Jul 26, 2023
2 parents 5a4525d + 70d7045 commit 70ab1c5
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 25 deletions.
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ go 1.20

require (
github.com/google/uuid v1.3.0
github.com/horockey/go-toolbox v1.1.1
github.com/rs/zerolog v1.29.1
github.com/stretchr/testify v1.8.4
golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df
golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1
)

require (
Expand Down
6 changes: 4 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/horockey/go-toolbox v1.1.1 h1:RIKFw+TgNFHQ1pOukoiUPJo+0kSWcR/grbXwNCaNJ8M=
github.com/horockey/go-toolbox v1.1.1/go.mod h1:CjlTSw3+DXSLZRlbhI3jfGcJSoZfeQ8ovHW720Li3bQ=
github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZbaA40=
github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y=
Expand All @@ -16,8 +18,8 @@ github.com/rs/zerolog v1.29.1 h1:cO+d60CHkknCbvzEWxP0S9K6KqyTjrCNUy1LdQLCGPc=
github.com/rs/zerolog v1.29.1/go.mod h1:Le6ESbR7hc+DP6Lt1THiV8CQSdkkNrd3R0XbEgp3ZBU=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df h1:UA2aFVmmsIlefxMk29Dp2juaUSth8Pyn3Tq5Y5mJGME=
golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc=
golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1 h1:MGwJjxBy0HJshjDNfLsYO8xppfqWlA5ZT9OhtUUhTNw=
golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.1.0 h1:kunALQeHf1/185U1i0GOB/fy1IPRDDpuoOOqRReG57U=
Expand Down
17 changes: 0 additions & 17 deletions pkg/options/option.go

This file was deleted.

2 changes: 1 addition & 1 deletion schedule_opts.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"time"

"github.com/horockey/go-scheduler/internal/model"
"github.com/horockey/go-scheduler/pkg/options"
"github.com/horockey/go-toolbox/options"
)

// Add a tag to event.
Expand Down
6 changes: 3 additions & 3 deletions sheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

"github.com/google/uuid"
"github.com/horockey/go-scheduler/internal/model"
"github.com/horockey/go-scheduler/pkg/options"
"github.com/horockey/go-toolbox/options"
"golang.org/x/exp/slices"
)

Expand Down Expand Up @@ -42,7 +42,7 @@ func NewScheduler[T any](opts ...options.Option[Scheduler[T]]) (*Scheduler[T], e
timeCh: make(<-chan time.Time),
errorCB: func(err error) {},
}
if err := options.ApplyOpts(s, opts...); err != nil {
if err := options.ApplyOptions(s, opts...); err != nil {
return nil, fmt.Errorf("applying opts: %w", err)
}
return s, nil
Expand Down Expand Up @@ -109,7 +109,7 @@ func (s *Scheduler[T]) Schedule(payload T, opts ...options.Option[model.Node[T]]
Event: e,
At: time.Now(),
}
if err := options.ApplyOpts(n, opts...); err != nil {
if err := options.ApplyOptions(n, opts...); err != nil {
return nil, fmt.Errorf("applying opts: %w", err)
}

Expand Down
2 changes: 1 addition & 1 deletion sheduler_opts.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"

"github.com/horockey/go-scheduler/internal/model"
"github.com/horockey/go-scheduler/pkg/options"
"github.com/horockey/go-toolbox/options"
)

// Set custom out chan.
Expand Down

0 comments on commit 70ab1c5

Please sign in to comment.