Unverified Commit 41c8584e authored by Mike Cutalo's avatar Mike Cutalo Committed by GitHub
Browse files

shortlink: refactor protos & add db table (#2071)

parent 9eab7ca6
No related merge requests found
Showing with 93 additions and 83 deletions
+93 -83
......@@ -4,9 +4,9 @@ package clutch.shortlink.v1;
option go_package = "github.com/lyft/clutch/backend/api/shortlink/v1;shortlinkv1";
import "google/protobuf/any.proto";
import "google/api/annotations.proto";
import "validate/validate.proto";
import "google/protobuf/struct.proto";
import "api/v1/annotations.proto";
......@@ -38,7 +38,7 @@ message CreateResponse {
}
message GetRequest {
string shortlink_hash = 1 [ (validate.rules).string = {min_bytes : 1} ];
string hash = 1 [ (validate.rules).string = {min_bytes : 1} ];
}
message GetResponse {
......@@ -52,5 +52,5 @@ message GetResponse {
// For example adding a "revision" identifier in the future.
message ShareableState {
string key = 1 [ (validate.rules).string = {min_bytes : 1} ];
google.protobuf.Any state = 2 [ (validate.rules).any.required = true ];
google.protobuf.Value state = 2 [ (validate.rules).any.required = true ];
}
......@@ -12,7 +12,7 @@ import (
_ "google.golang.org/genproto/googleapis/api/annotations"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
anypb "google.golang.org/protobuf/types/known/anypb"
structpb "google.golang.org/protobuf/types/known/structpb"
reflect "reflect"
sync "sync"
)
......@@ -131,7 +131,7 @@ type GetRequest struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
ShortlinkHash string `protobuf:"bytes,1,opt,name=shortlink_hash,json=shortlinkHash,proto3" json:"shortlink_hash,omitempty"`
Hash string `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"`
}
func (x *GetRequest) Reset() {
......@@ -166,9 +166,9 @@ func (*GetRequest) Descriptor() ([]byte, []int) {
return file_shortlink_v1_shortlink_proto_rawDescGZIP(), []int{2}
}
func (x *GetRequest) GetShortlinkHash() string {
func (x *GetRequest) GetHash() string {
if x != nil {
return x.ShortlinkHash
return x.Hash
}
return ""
}
......@@ -237,8 +237,8 @@ type ShareableState struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
State *anypb.Any `protobuf:"bytes,2,opt,name=state,proto3" json:"state,omitempty"`
Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
State *structpb.Value `protobuf:"bytes,2,opt,name=state,proto3" json:"state,omitempty"`
}
func (x *ShareableState) Reset() {
......@@ -280,7 +280,7 @@ func (x *ShareableState) GetKey() string {
return ""
}
func (x *ShareableState) GetState() *anypb.Any {
func (x *ShareableState) GetState() *structpb.Value {
if x != nil {
return x.State
}
......@@ -293,59 +293,58 @@ var file_shortlink_v1_shortlink_proto_rawDesc = []byte{
0x0a, 0x1c, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x6c, 0x69, 0x6e, 0x6b, 0x2f, 0x76, 0x31, 0x2f, 0x73,
0x68, 0x6f, 0x72, 0x74, 0x6c, 0x69, 0x6e, 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x13,
0x63, 0x6c, 0x75, 0x74, 0x63, 0x68, 0x2e, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x6c, 0x69, 0x6e, 0x6b,
0x2e, 0x76, 0x31, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c,
0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74,
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x76, 0x61,
0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x18, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x6e,
0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22,
0x71, 0x0a, 0x0d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x12, 0x1b, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07,
0xfa, 0x42, 0x04, 0x72, 0x02, 0x20, 0x01, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x43, 0x0a,
0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x63,
0x6c, 0x75, 0x74, 0x63, 0x68, 0x2e, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x6c, 0x69, 0x6e, 0x6b, 0x2e,
0x76, 0x31, 0x2e, 0x53, 0x68, 0x61, 0x72, 0x65, 0x61, 0x62, 0x6c, 0x65, 0x53, 0x74, 0x61, 0x74,
0x65, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x92, 0x01, 0x02, 0x08, 0x01, 0x52, 0x05, 0x73, 0x74, 0x61,
0x74, 0x65, 0x22, 0x24, 0x0a, 0x0e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70,
0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01,
0x28, 0x09, 0x52, 0x04, 0x68, 0x61, 0x73, 0x68, 0x22, 0x3c, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2e, 0x0a, 0x0e, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x6c,
0x69, 0x6e, 0x6b, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07,
0xfa, 0x42, 0x04, 0x72, 0x02, 0x20, 0x01, 0x52, 0x0d, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x6c, 0x69,
0x6e, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x22, 0x5c, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73,
0x2e, 0x76, 0x31, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f,
0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x1a, 0x17, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69,
0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67,
0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x73, 0x74, 0x72, 0x75,
0x63, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x18, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31,
0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x22, 0x71, 0x0a, 0x0d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75,
0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28,
0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x20, 0x01, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68,
0x12, 0x43, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32,
0x23, 0x2e, 0x63, 0x6c, 0x75, 0x74, 0x63, 0x68, 0x2e, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x6c, 0x69,
0x6e, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x68, 0x61, 0x72, 0x65, 0x61, 0x62, 0x6c, 0x65, 0x53,
0x74, 0x61, 0x74, 0x65, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x92, 0x01, 0x02, 0x08, 0x01, 0x52, 0x05,
0x73, 0x74, 0x61, 0x74, 0x65, 0x22, 0x24, 0x0a, 0x0e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52,
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x61, 0x73, 0x68, 0x18,
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x61, 0x73, 0x68, 0x22, 0x29, 0x0a, 0x0a, 0x47,
0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x04, 0x68, 0x61, 0x73,
0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x20, 0x01,
0x52, 0x04, 0x68, 0x61, 0x73, 0x68, 0x22, 0x5c, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20,
0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x39, 0x0a, 0x05, 0x73, 0x74, 0x61,
0x74, 0x65, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x63, 0x6c, 0x75, 0x74, 0x63,
0x68, 0x2e, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x6c, 0x69, 0x6e, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x53,
0x68, 0x61, 0x72, 0x65, 0x61, 0x62, 0x6c, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x05, 0x73,
0x74, 0x61, 0x74, 0x65, 0x22, 0x61, 0x0a, 0x0e, 0x53, 0x68, 0x61, 0x72, 0x65, 0x61, 0x62, 0x6c,
0x74, 0x61, 0x74, 0x65, 0x22, 0x63, 0x0a, 0x0e, 0x53, 0x68, 0x61, 0x72, 0x65, 0x61, 0x62, 0x6c,
0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x19, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20,
0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x20, 0x01, 0x52, 0x03, 0x6b, 0x65,
0x79, 0x12, 0x34, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,
0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x42, 0x08, 0xfa, 0x42, 0x05, 0xa2, 0x01, 0x02, 0x08, 0x01,
0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x32, 0xf6, 0x01, 0x0a, 0x0c, 0x53, 0x68, 0x6f, 0x72,
0x74, 0x6c, 0x69, 0x6e, 0x6b, 0x41, 0x50, 0x49, 0x12, 0x78, 0x0a, 0x06, 0x43, 0x72, 0x65, 0x61,
0x74, 0x65, 0x12, 0x22, 0x2e, 0x63, 0x6c, 0x75, 0x74, 0x63, 0x68, 0x2e, 0x73, 0x68, 0x6f, 0x72,
0x74, 0x6c, 0x69, 0x6e, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x63, 0x6c, 0x75, 0x74, 0x63, 0x68, 0x2e,
0x73, 0x68, 0x6f, 0x72, 0x74, 0x6c, 0x69, 0x6e, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65,
0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x25, 0x82, 0xd3, 0xe4,
0x93, 0x02, 0x19, 0x22, 0x14, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x6c, 0x69,
0x6e, 0x6b, 0x2f, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x3a, 0x01, 0x2a, 0xaa, 0xe1, 0x1c, 0x02,
0x08, 0x01, 0x12, 0x6c, 0x0a, 0x03, 0x47, 0x65, 0x74, 0x12, 0x1f, 0x2e, 0x63, 0x6c, 0x75, 0x74,
0x63, 0x68, 0x2e, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x6c, 0x69, 0x6e, 0x6b, 0x2e, 0x76, 0x31, 0x2e,
0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x63, 0x6c, 0x75,
0x74, 0x63, 0x68, 0x2e, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x6c, 0x69, 0x6e, 0x6b, 0x2e, 0x76, 0x31,
0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x22, 0x82, 0xd3,
0xe4, 0x93, 0x02, 0x16, 0x22, 0x11, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x6c,
0x69, 0x6e, 0x6b, 0x2f, 0x67, 0x65, 0x74, 0x3a, 0x01, 0x2a, 0xaa, 0xe1, 0x1c, 0x02, 0x08, 0x02,
0x42, 0x3d, 0x5a, 0x3b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6c,
0x79, 0x66, 0x74, 0x2f, 0x63, 0x6c, 0x75, 0x74, 0x63, 0x68, 0x2f, 0x62, 0x61, 0x63, 0x6b, 0x65,
0x6e, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x6c, 0x69, 0x6e, 0x6b,
0x2f, 0x76, 0x31, 0x3b, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x6c, 0x69, 0x6e, 0x6b, 0x76, 0x31, 0x62,
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x79, 0x12, 0x36, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,
0x75, 0x66, 0x2e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x08, 0xfa, 0x42, 0x05, 0xa2, 0x01, 0x02,
0x08, 0x01, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x32, 0xf6, 0x01, 0x0a, 0x0c, 0x53, 0x68,
0x6f, 0x72, 0x74, 0x6c, 0x69, 0x6e, 0x6b, 0x41, 0x50, 0x49, 0x12, 0x78, 0x0a, 0x06, 0x43, 0x72,
0x65, 0x61, 0x74, 0x65, 0x12, 0x22, 0x2e, 0x63, 0x6c, 0x75, 0x74, 0x63, 0x68, 0x2e, 0x73, 0x68,
0x6f, 0x72, 0x74, 0x6c, 0x69, 0x6e, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74,
0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x63, 0x6c, 0x75, 0x74, 0x63,
0x68, 0x2e, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x6c, 0x69, 0x6e, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x43,
0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x25, 0x82,
0xd3, 0xe4, 0x93, 0x02, 0x19, 0x22, 0x14, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x68, 0x6f, 0x72, 0x74,
0x6c, 0x69, 0x6e, 0x6b, 0x2f, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x3a, 0x01, 0x2a, 0xaa, 0xe1,
0x1c, 0x02, 0x08, 0x01, 0x12, 0x6c, 0x0a, 0x03, 0x47, 0x65, 0x74, 0x12, 0x1f, 0x2e, 0x63, 0x6c,
0x75, 0x74, 0x63, 0x68, 0x2e, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x6c, 0x69, 0x6e, 0x6b, 0x2e, 0x76,
0x31, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x63,
0x6c, 0x75, 0x74, 0x63, 0x68, 0x2e, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x6c, 0x69, 0x6e, 0x6b, 0x2e,
0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x22,
0x82, 0xd3, 0xe4, 0x93, 0x02, 0x16, 0x22, 0x11, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x68, 0x6f, 0x72,
0x74, 0x6c, 0x69, 0x6e, 0x6b, 0x2f, 0x67, 0x65, 0x74, 0x3a, 0x01, 0x2a, 0xaa, 0xe1, 0x1c, 0x02,
0x08, 0x02, 0x42, 0x3d, 0x5a, 0x3b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d,
0x2f, 0x6c, 0x79, 0x66, 0x74, 0x2f, 0x63, 0x6c, 0x75, 0x74, 0x63, 0x68, 0x2f, 0x62, 0x61, 0x63,
0x6b, 0x65, 0x6e, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x6c, 0x69,
0x6e, 0x6b, 0x2f, 0x76, 0x31, 0x3b, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x6c, 0x69, 0x6e, 0x6b, 0x76,
0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
......@@ -367,12 +366,12 @@ var file_shortlink_v1_shortlink_proto_goTypes = []interface{}{
(*GetRequest)(nil), // 2: clutch.shortlink.v1.GetRequest
(*GetResponse)(nil), // 3: clutch.shortlink.v1.GetResponse
(*ShareableState)(nil), // 4: clutch.shortlink.v1.ShareableState
(*anypb.Any)(nil), // 5: google.protobuf.Any
(*structpb.Value)(nil), // 5: google.protobuf.Value
}
var file_shortlink_v1_shortlink_proto_depIdxs = []int32{
4, // 0: clutch.shortlink.v1.CreateRequest.state:type_name -> clutch.shortlink.v1.ShareableState
4, // 1: clutch.shortlink.v1.GetResponse.state:type_name -> clutch.shortlink.v1.ShareableState
5, // 2: clutch.shortlink.v1.ShareableState.state:type_name -> google.protobuf.Any
5, // 2: clutch.shortlink.v1.ShareableState.state:type_name -> google.protobuf.Value
0, // 3: clutch.shortlink.v1.ShortlinkAPI.Create:input_type -> clutch.shortlink.v1.CreateRequest
2, // 4: clutch.shortlink.v1.ShortlinkAPI.Get:input_type -> clutch.shortlink.v1.GetRequest
1, // 5: clutch.shortlink.v1.ShortlinkAPI.Create:output_type -> clutch.shortlink.v1.CreateResponse
......
......@@ -313,9 +313,9 @@ func (m *GetRequest) validate(all bool) error {
var errors []error
if len(m.GetShortlinkHash()) < 1 {
if len(m.GetHash()) < 1 {
err := GetRequestValidationError{
field: "ShortlinkHash",
field: "Hash",
reason: "value length must be at least 1 bytes",
}
if !all {
......
DROP TABLE IF EXISTS shortlink;
CREATE TABLE shortlink (
-- hash is the unique identifer for the shortlink
slhash text PRIMARY KEY,
-- path is the page path to rediect to
page_path text,
-- state is shortlink state
state JSONB
);
CREATE INDEX IF NOT EXISTS state_json ON shortlink USING GIN (state jsonb_path_ops);
......@@ -22200,8 +22200,8 @@ export namespace clutch {
/** Properties of a GetRequest. */
interface IGetRequest {
 
/** GetRequest shortlinkHash */
shortlinkHash?: (string|null);
/** GetRequest hash */
hash?: (string|null);
}
 
/** Represents a GetRequest. */
......@@ -22213,8 +22213,8 @@ export namespace clutch {
*/
constructor(properties?: clutch.shortlink.v1.IGetRequest);
 
/** GetRequest shortlinkHash. */
public shortlinkHash: string;
/** GetRequest hash. */
public hash: string;
 
/**
* Verifies a GetRequest message.
......@@ -22306,7 +22306,7 @@ export namespace clutch {
key?: (string|null);
 
/** ShareableState state */
state?: (google.protobuf.IAny|null);
state?: (google.protobuf.IValue|null);
}
 
/** Represents a ShareableState. */
......@@ -22322,7 +22322,7 @@ export namespace clutch {
public key: string;
 
/** ShareableState state. */
public state?: (google.protobuf.IAny|null);
public state?: (google.protobuf.IValue|null);
 
/**
* Verifies a ShareableState message.
......@@ -52987,7 +52987,7 @@ export const clutch = $root.clutch = (() => {
* Properties of a GetRequest.
* @memberof clutch.shortlink.v1
* @interface IGetRequest
* @property {string|null} [shortlinkHash] GetRequest shortlinkHash
* @property {string|null} [hash] GetRequest hash
*/
 
/**
......@@ -53006,12 +53006,12 @@ export const clutch = $root.clutch = (() => {
}
 
/**
* GetRequest shortlinkHash.
* @member {string} shortlinkHash
* GetRequest hash.
* @member {string} hash
* @memberof clutch.shortlink.v1.GetRequest
* @instance
*/
GetRequest.prototype.shortlinkHash = "";
GetRequest.prototype.hash = "";
 
/**
* Verifies a GetRequest message.
......@@ -53024,9 +53024,9 @@ export const clutch = $root.clutch = (() => {
GetRequest.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.shortlinkHash != null && message.hasOwnProperty("shortlinkHash"))
if (!$util.isString(message.shortlinkHash))
return "shortlinkHash: string expected";
if (message.hash != null && message.hasOwnProperty("hash"))
if (!$util.isString(message.hash))
return "hash: string expected";
return null;
};
 
......@@ -53042,8 +53042,8 @@ export const clutch = $root.clutch = (() => {
if (object instanceof $root.clutch.shortlink.v1.GetRequest)
return object;
let message = new $root.clutch.shortlink.v1.GetRequest();
if (object.shortlinkHash != null)
message.shortlinkHash = String(object.shortlinkHash);
if (object.hash != null)
message.hash = String(object.hash);
return message;
};
 
......@@ -53061,9 +53061,9 @@ export const clutch = $root.clutch = (() => {
options = {};
let object = {};
if (options.defaults)
object.shortlinkHash = "";
if (message.shortlinkHash != null && message.hasOwnProperty("shortlinkHash"))
object.shortlinkHash = message.shortlinkHash;
object.hash = "";
if (message.hash != null && message.hasOwnProperty("hash"))
object.hash = message.hash;
return object;
};
 
......@@ -53224,7 +53224,7 @@ export const clutch = $root.clutch = (() => {
* @memberof clutch.shortlink.v1
* @interface IShareableState
* @property {string|null} [key] ShareableState key
* @property {google.protobuf.IAny|null} [state] ShareableState state
* @property {google.protobuf.IValue|null} [state] ShareableState state
*/
 
/**
......@@ -53252,7 +53252,7 @@ export const clutch = $root.clutch = (() => {
 
/**
* ShareableState state.
* @member {google.protobuf.IAny|null|undefined} state
* @member {google.protobuf.IValue|null|undefined} state
* @memberof clutch.shortlink.v1.ShareableState
* @instance
*/
......@@ -53273,7 +53273,7 @@ export const clutch = $root.clutch = (() => {
if (!$util.isString(message.key))
return "key: string expected";
if (message.state != null && message.hasOwnProperty("state")) {
let error = $root.google.protobuf.Any.verify(message.state);
let error = $root.google.protobuf.Value.verify(message.state);
if (error)
return "state." + error;
}
......@@ -53297,7 +53297,7 @@ export const clutch = $root.clutch = (() => {
if (object.state != null) {
if (typeof object.state !== "object")
throw TypeError(".clutch.shortlink.v1.ShareableState.state: object expected");
message.state = $root.google.protobuf.Any.fromObject(object.state);
message.state = $root.google.protobuf.Value.fromObject(object.state);
}
return message;
};
......@@ -53322,7 +53322,7 @@ export const clutch = $root.clutch = (() => {
if (message.key != null && message.hasOwnProperty("key"))
object.key = message.key;
if (message.state != null && message.hasOwnProperty("state"))
object.state = $root.google.protobuf.Any.toObject(message.state, options);
object.state = $root.google.protobuf.Value.toObject(message.state, options);
return object;
};
 
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment