Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Service ¶
type Service interface { CreateShort(ctx context.Context, origin string, opts ...grpc.CallOption) (string, error) GetOrigin(ctx context.Context, short string, opts ...grpc.CallOption) (string, error) Get(ctx context.Context, short string, opts ...grpc.CallOption) (*proto.URL, error) }
Service represents wrapped grpc service.
func NewService ¶
func NewService(conn *grpc.ClientConn) Service
NewService creates and wraps a new service.
type Shortener ¶
Shortener shortens a URL.
func NewCRC64Shortener ¶
NewCRC64Shortener creates a new shortener that uses CRC64 as a hash function.
type URLService ¶
type URLService struct { proto.UnimplementedURLServiceServer // contains filtered or unexported fields }
URLService implements proto.URLService interface.
func NewURLService ¶
func NewURLService(repo repo.Repository, shortener ...Shortener) *URLService
NewURLService creates a new service.
func (*URLService) CreateShort ¶
CreateShort creates a short link.
Click to show internal directories.
Click to hide internal directories.