Skip to content
Snippets Groups Projects
Commit ff9426a1 authored by Alena Petraki's avatar Alena Petraki
Browse files

Убран лишний уровень вложенности

parent b3791d21
No related branches found
No related tags found
No related merge requests found
package client package account
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)
......
package client package account
import ( import (
"github.com/go-kit/kit/transport/grpc" "github.com/go-kit/kit/transport/grpc"
......
package client package content
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)
......
package client package content
import ( import (
kitgrpc "github.com/go-kit/kit/transport/grpc" kitgrpc "github.com/go-kit/kit/transport/grpc"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment