Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
perxis-go
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Package registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
perxis
perxis-go
Commits
ff9426a1
Commit
ff9426a1
authored
2 years ago
by
Alena Petraki
Browse files
Options
Downloads
Patches
Plain Diff
Убран лишний уровень вложенности
parent
b3791d21
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
pkg/account/client.go
+5
-6
5 additions, 6 deletions
pkg/account/client.go
pkg/account/config.go
+1
-1
1 addition, 1 deletion
pkg/account/config.go
pkg/content/client.go
+5
-6
5 additions, 6 deletions
pkg/content/client.go
pkg/content/config.go
+1
-1
1 addition, 1 deletion
pkg/content/config.go
with
12 additions
and
14 deletions
pkg/account/client
/client
.go
→
pkg/account/client.go
+
5
−
6
View file @
ff9426a1
package
clie
nt
package
accou
nt
import
(
import
(
"context"
"context"
...
@@ -8,7 +8,6 @@ import (
...
@@ -8,7 +8,6 @@ import (
"net/url"
"net/url"
"time"
"time"
"git.perx.ru/perxis/perxis-go/pkg/account"
"git.perx.ru/perxis/perxis-go/pkg/cache"
"git.perx.ru/perxis/perxis-go/pkg/cache"
serviceMembers
"git.perx.ru/perxis/perxis-go/pkg/members/middleware"
serviceMembers
"git.perx.ru/perxis/perxis-go/pkg/members/middleware"
membersObserverTransport
"git.perx.ru/perxis/perxis-go/pkg/members/observer/transport/grpc"
membersObserverTransport
"git.perx.ru/perxis/perxis-go/pkg/members/observer/transport/grpc"
...
@@ -31,9 +30,9 @@ const (
...
@@ -31,9 +30,9 @@ const (
DefaultCacheTTL
=
time
.
Second
*
10
DefaultCacheTTL
=
time
.
Second
*
10
)
)
func
NewClient
(
ctx
context
.
Context
,
addr
string
,
opts
...
Option
)
(
*
account
.
Account
,
*
grpc
.
ClientConn
,
error
)
{
func
NewClient
(
ctx
context
.
Context
,
addr
string
,
opts
...
Option
)
(
*
Account
,
*
grpc
.
ClientConn
,
error
)
{
client
:=
&
account
.
Account
{}
client
:=
&
Account
{}
dialOpts
:=
make
([]
grpc
.
DialOption
,
0
)
dialOpts
:=
make
([]
grpc
.
DialOption
,
0
)
config
:=
&
config
{}
config
:=
&
config
{}
...
@@ -118,7 +117,7 @@ func NewClient(ctx context.Context, addr string, opts ...Option) (*account.Accou
...
@@ -118,7 +117,7 @@ func NewClient(ctx context.Context, addr string, opts ...Option) (*account.Accou
return
client
,
accountConn
,
nil
return
client
,
accountConn
,
nil
}
}
func
WithCaching
(
client
*
account
.
Account
,
size
int
,
ttl
time
.
Duration
)
*
account
.
Account
{
func
WithCaching
(
client
*
Account
,
size
int
,
ttl
time
.
Duration
)
*
Account
{
c
:=
*
client
c
:=
*
client
c
.
Members
=
serviceMembers
.
CachingMiddleware
(
cache
.
NewCache
(
size
,
ttl
))(
client
.
Members
)
c
.
Members
=
serviceMembers
.
CachingMiddleware
(
cache
.
NewCache
(
size
,
ttl
))(
client
.
Members
)
...
@@ -128,7 +127,7 @@ func WithCaching(client *account.Account, size int, ttl time.Duration) *account.
...
@@ -128,7 +127,7 @@ func WithCaching(client *account.Account, size int, ttl time.Duration) *account.
return
&
c
return
&
c
}
}
func
WithLogging
(
client
*
account
.
Account
,
logger
*
zap
.
Logger
,
accessLog
bool
)
*
account
.
Account
{
func
WithLogging
(
client
*
Account
,
logger
*
zap
.
Logger
,
accessLog
bool
)
*
Account
{
c
:=
*
client
c
:=
*
client
c
.
Members
=
serviceMembers
.
WithLog
(
c
.
Members
,
logger
,
accessLog
)
c
.
Members
=
serviceMembers
.
WithLog
(
c
.
Members
,
logger
,
accessLog
)
...
...
This diff is collapsed.
Click to expand it.
pkg/account/
client/
config.go
→
pkg/account/config.go
+
1
−
1
View file @
ff9426a1
package
clie
nt
package
accou
nt
import
(
import
(
"github.com/go-kit/kit/transport/grpc"
"github.com/go-kit/kit/transport/grpc"
...
...
This diff is collapsed.
Click to expand it.
pkg/content/client
/client
.go
→
pkg/content/client.go
+
5
−
6
View file @
ff9426a1
package
c
li
ent
package
c
ont
ent
import
(
import
(
"context"
"context"
...
@@ -16,7 +16,6 @@ import (
...
@@ -16,7 +16,6 @@ import (
collaboratorsTransportGrpc
"git.perx.ru/perxis/perxis-go/pkg/collaborators/transport/grpc"
collaboratorsTransportGrpc
"git.perx.ru/perxis/perxis-go/pkg/collaborators/transport/grpc"
collectionsSvc
"git.perx.ru/perxis/perxis-go/pkg/collections/middleware"
collectionsSvc
"git.perx.ru/perxis/perxis-go/pkg/collections/middleware"
collectionsTransportGrpc
"git.perx.ru/perxis/perxis-go/pkg/collections/transport/grpc"
collectionsTransportGrpc
"git.perx.ru/perxis/perxis-go/pkg/collections/transport/grpc"
"git.perx.ru/perxis/perxis-go/pkg/content"
environmentsSvc
"git.perx.ru/perxis/perxis-go/pkg/environments/middleware"
environmentsSvc
"git.perx.ru/perxis/perxis-go/pkg/environments/middleware"
environmentsTransportGrpc
"git.perx.ru/perxis/perxis-go/pkg/environments/transport/grpc"
environmentsTransportGrpc
"git.perx.ru/perxis/perxis-go/pkg/environments/transport/grpc"
invitationsSvc
"git.perx.ru/perxis/perxis-go/pkg/invitations/middleware"
invitationsSvc
"git.perx.ru/perxis/perxis-go/pkg/invitations/middleware"
...
@@ -45,10 +44,10 @@ const (
...
@@ -45,10 +44,10 @@ const (
DefaultCacheTTL
=
time
.
Second
*
10
DefaultCacheTTL
=
time
.
Second
*
10
)
)
func
NewClient
(
addr
string
,
opts
...
Option
)
(
*
content
.
Content
,
*
grpc
.
ClientConn
,
error
)
{
func
NewClient
(
addr
string
,
opts
...
Option
)
(
*
Content
,
*
grpc
.
ClientConn
,
error
)
{
ctx
:=
context
.
Background
()
ctx
:=
context
.
Background
()
client
:=
&
content
.
Content
{}
client
:=
&
Content
{}
dialOpts
:=
make
([]
grpc
.
DialOption
,
0
)
dialOpts
:=
make
([]
grpc
.
DialOption
,
0
)
config
:=
&
Config
{}
config
:=
&
Config
{}
...
@@ -98,7 +97,7 @@ func NewClient(addr string, opts ...Option) (*content.Content, *grpc.ClientConn,
...
@@ -98,7 +97,7 @@ func NewClient(addr string, opts ...Option) (*content.Content, *grpc.ClientConn,
return
client
,
contentConn
,
nil
return
client
,
contentConn
,
nil
}
}
func
WithCaching
(
client
*
content
.
Content
,
size
int
,
ttl
time
.
Duration
)
*
content
.
Content
{
func
WithCaching
(
client
*
Content
,
size
int
,
ttl
time
.
Duration
)
*
Content
{
c
:=
*
client
c
:=
*
client
c
.
Clients
=
clientsSvc
.
CachingMiddleware
(
cache
.
NewCache
(
size
,
ttl
))(
client
.
Clients
)
c
.
Clients
=
clientsSvc
.
CachingMiddleware
(
cache
.
NewCache
(
size
,
ttl
))(
client
.
Clients
)
...
@@ -114,7 +113,7 @@ func WithCaching(client *content.Content, size int, ttl time.Duration) *content.
...
@@ -114,7 +113,7 @@ func WithCaching(client *content.Content, size int, ttl time.Duration) *content.
return
&
c
return
&
c
}
}
func
WithLogging
(
cs
*
content
.
Content
,
logger
*
zap
.
Logger
,
accessLog
bool
)
*
content
.
Content
{
func
WithLogging
(
cs
*
Content
,
logger
*
zap
.
Logger
,
accessLog
bool
)
*
Content
{
s
:=
*
cs
s
:=
*
cs
s
.
Collaborators
=
collaboratorsSvc
.
WithLog
(
s
.
Collaborators
,
logger
,
accessLog
)
s
.
Collaborators
=
collaboratorsSvc
.
WithLog
(
s
.
Collaborators
,
logger
,
accessLog
)
...
...
This diff is collapsed.
Click to expand it.
pkg/content/
client/
config.go
→
pkg/content/config.go
+
1
−
1
View file @
ff9426a1
package
c
li
ent
package
c
ont
ent
import
(
import
(
kitgrpc
"github.com/go-kit/kit/transport/grpc"
kitgrpc
"github.com/go-kit/kit/transport/grpc"
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment