mirror of
https://github.com/go-micro/go-micro.git
synced 2024-11-24 08:02:32 +02:00
Add Context in event options (#2634)
Co-authored-by: mamadeusia <timadues7775@gmail.com>
This commit is contained in:
parent
31135d4696
commit
67d48b205e
@ -1,6 +1,7 @@
|
|||||||
package events
|
package events
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"go-micro.dev/v4/logger"
|
"go-micro.dev/v4/logger"
|
||||||
@ -148,6 +149,8 @@ func WithTTL(d time.Duration) WriteOption {
|
|||||||
type ReadOptions struct {
|
type ReadOptions struct {
|
||||||
// Limit the number of results to return
|
// Limit the number of results to return
|
||||||
Limit uint
|
Limit uint
|
||||||
|
// Context should contain all implementation specific options, using context.WithValue.
|
||||||
|
Context context.Context
|
||||||
// Offset the results by this number, useful for paginated queries
|
// Offset the results by this number, useful for paginated queries
|
||||||
Offset uint
|
Offset uint
|
||||||
}
|
}
|
||||||
@ -158,13 +161,13 @@ type ReadOption func(o *ReadOptions)
|
|||||||
// ReadLimit sets the limit attribute on ReadOptions.
|
// ReadLimit sets the limit attribute on ReadOptions.
|
||||||
func ReadLimit(l uint) ReadOption {
|
func ReadLimit(l uint) ReadOption {
|
||||||
return func(o *ReadOptions) {
|
return func(o *ReadOptions) {
|
||||||
o.Limit = 1
|
o.Limit = l
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReadOffset sets the offset attribute on ReadOptions.
|
// ReadOffset sets the offset attribute on ReadOptions.
|
||||||
func ReadOffset(l uint) ReadOption {
|
func ReadOffset(l uint) ReadOption {
|
||||||
return func(o *ReadOptions) {
|
return func(o *ReadOptions) {
|
||||||
o.Offset = 1
|
o.Offset = l
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
1
go.sum
1
go.sum
@ -338,7 +338,6 @@ github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI
|
|||||||
github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k=
|
github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k=
|
||||||
github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k=
|
github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k=
|
||||||
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||||
github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
|
|
||||||
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
|
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
|
||||||
github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY=
|
github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY=
|
||||||
github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw=
|
github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw=
|
||||||
|
@ -258,7 +258,9 @@ func NewService(name, version, typ, namespace string) *Service {
|
|||||||
Type: "ClusterIP",
|
Type: "ClusterIP",
|
||||||
Selector: Labels,
|
Selector: Labels,
|
||||||
Ports: []ServicePort{{
|
Ports: []ServicePort{{
|
||||||
"service-port", 8080, "",
|
Name: "service-port",
|
||||||
|
Protocol: "",
|
||||||
|
Port: 8080,
|
||||||
}},
|
}},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user