New: Generate gRPC Stubs using buf
This commit is contained in:
18
buf.gen.yaml
Normal file
18
buf.gen.yaml
Normal file
@@ -0,0 +1,18 @@
|
||||
version: v2
|
||||
plugins:
|
||||
- local: [go, tool, protoc-gen-go]
|
||||
out: internal
|
||||
opt: paths=source_relative
|
||||
- local: [go, tool, protoc-gen-connect-go]
|
||||
out: internal
|
||||
opt:
|
||||
- paths=source_relative
|
||||
- simple
|
||||
managed:
|
||||
enabled: true
|
||||
override:
|
||||
- file_option: go_package_prefix
|
||||
value: git.kocoder.xyz/vt/financial-tracking-service/internal
|
||||
disable:
|
||||
- file_option: go_package
|
||||
module: buf.build/bufbuild/protovalidate
|
||||
6
buf.lock
Normal file
6
buf.lock
Normal file
@@ -0,0 +1,6 @@
|
||||
# Generated by buf. DO NOT EDIT.
|
||||
version: v2
|
||||
deps:
|
||||
- name: buf.build/bufbuild/protovalidate
|
||||
commit: 50325440f8f24053b047484a6bf60b76
|
||||
digest: b5:74cb6f5c0853c3c10aafc701614194bbd63326bdb8ef4068214454b8894b03ba4113e04b3a33a8321cdf05336e37db4dc14a5e2495db8462566914f36086ba31
|
||||
9
buf.yaml
Normal file
9
buf.yaml
Normal file
@@ -0,0 +1,9 @@
|
||||
version: v2
|
||||
deps:
|
||||
- buf.build/bufbuild/protovalidate
|
||||
lint:
|
||||
use:
|
||||
- STANDARD
|
||||
breaking:
|
||||
use:
|
||||
- FILE
|
||||
2
gen-proto.sh
Executable file
2
gen-proto.sh
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
go run github.com/bufbuild/buf/cmd/buf@v1.47.2 generate --path proto/transaction
|
||||
585
internal/proto/transaction/v1/transaction.pb.go
Normal file
585
internal/proto/transaction/v1/transaction.pb.go
Normal file
@@ -0,0 +1,585 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.36.11
|
||||
// protoc (unknown)
|
||||
// source: proto/transaction/v1/transaction.proto
|
||||
|
||||
package transactionv1
|
||||
|
||||
import (
|
||||
_ "buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go/buf/validate"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
timestamppb "google.golang.org/protobuf/types/known/timestamppb"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
unsafe "unsafe"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
type Transaction struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
TransactionId int32 `protobuf:"varint,1,opt,name=transaction_id,json=transactionId,proto3" json:"transaction_id,omitempty"`
|
||||
Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"`
|
||||
Amount string `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount,omitempty"`
|
||||
Category string `protobuf:"bytes,4,opt,name=category,proto3" json:"category,omitempty"`
|
||||
TransactionDate *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=transaction_date,json=transactionDate,proto3" json:"transaction_date,omitempty"`
|
||||
CreatedAt *timestamppb.Timestamp `protobuf:"bytes,6,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *Transaction) Reset() {
|
||||
*x = Transaction{}
|
||||
mi := &file_proto_transaction_v1_transaction_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *Transaction) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Transaction) ProtoMessage() {}
|
||||
|
||||
func (x *Transaction) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_transaction_v1_transaction_proto_msgTypes[0]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use Transaction.ProtoReflect.Descriptor instead.
|
||||
func (*Transaction) Descriptor() ([]byte, []int) {
|
||||
return file_proto_transaction_v1_transaction_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *Transaction) GetTransactionId() int32 {
|
||||
if x != nil {
|
||||
return x.TransactionId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *Transaction) GetDescription() string {
|
||||
if x != nil {
|
||||
return x.Description
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Transaction) GetAmount() string {
|
||||
if x != nil {
|
||||
return x.Amount
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Transaction) GetCategory() string {
|
||||
if x != nil {
|
||||
return x.Category
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Transaction) GetTransactionDate() *timestamppb.Timestamp {
|
||||
if x != nil {
|
||||
return x.TransactionDate
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Transaction) GetCreatedAt() *timestamppb.Timestamp {
|
||||
if x != nil {
|
||||
return x.CreatedAt
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type CreateTransactionRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Description string `protobuf:"bytes,1,opt,name=description,proto3" json:"description,omitempty"`
|
||||
Amount string `protobuf:"bytes,2,opt,name=amount,proto3" json:"amount,omitempty"`
|
||||
Category string `protobuf:"bytes,3,opt,name=category,proto3" json:"category,omitempty"`
|
||||
TransactionDate *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=transaction_date,json=transactionDate,proto3" json:"transaction_date,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *CreateTransactionRequest) Reset() {
|
||||
*x = CreateTransactionRequest{}
|
||||
mi := &file_proto_transaction_v1_transaction_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *CreateTransactionRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*CreateTransactionRequest) ProtoMessage() {}
|
||||
|
||||
func (x *CreateTransactionRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_transaction_v1_transaction_proto_msgTypes[1]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use CreateTransactionRequest.ProtoReflect.Descriptor instead.
|
||||
func (*CreateTransactionRequest) Descriptor() ([]byte, []int) {
|
||||
return file_proto_transaction_v1_transaction_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *CreateTransactionRequest) GetDescription() string {
|
||||
if x != nil {
|
||||
return x.Description
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *CreateTransactionRequest) GetAmount() string {
|
||||
if x != nil {
|
||||
return x.Amount
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *CreateTransactionRequest) GetCategory() string {
|
||||
if x != nil {
|
||||
return x.Category
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *CreateTransactionRequest) GetTransactionDate() *timestamppb.Timestamp {
|
||||
if x != nil {
|
||||
return x.TransactionDate
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type CreateTransactionResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Transaction *Transaction `protobuf:"bytes,1,opt,name=transaction,proto3" json:"transaction,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *CreateTransactionResponse) Reset() {
|
||||
*x = CreateTransactionResponse{}
|
||||
mi := &file_proto_transaction_v1_transaction_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *CreateTransactionResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*CreateTransactionResponse) ProtoMessage() {}
|
||||
|
||||
func (x *CreateTransactionResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_transaction_v1_transaction_proto_msgTypes[2]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use CreateTransactionResponse.ProtoReflect.Descriptor instead.
|
||||
func (*CreateTransactionResponse) Descriptor() ([]byte, []int) {
|
||||
return file_proto_transaction_v1_transaction_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *CreateTransactionResponse) GetTransaction() *Transaction {
|
||||
if x != nil {
|
||||
return x.Transaction
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type ListTransactionsRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *ListTransactionsRequest) Reset() {
|
||||
*x = ListTransactionsRequest{}
|
||||
mi := &file_proto_transaction_v1_transaction_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *ListTransactionsRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ListTransactionsRequest) ProtoMessage() {}
|
||||
|
||||
func (x *ListTransactionsRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_transaction_v1_transaction_proto_msgTypes[3]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ListTransactionsRequest.ProtoReflect.Descriptor instead.
|
||||
func (*ListTransactionsRequest) Descriptor() ([]byte, []int) {
|
||||
return file_proto_transaction_v1_transaction_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
type ListTransactionsResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Transactions []*Transaction `protobuf:"bytes,1,rep,name=transactions,proto3" json:"transactions,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *ListTransactionsResponse) Reset() {
|
||||
*x = ListTransactionsResponse{}
|
||||
mi := &file_proto_transaction_v1_transaction_proto_msgTypes[4]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *ListTransactionsResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ListTransactionsResponse) ProtoMessage() {}
|
||||
|
||||
func (x *ListTransactionsResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_transaction_v1_transaction_proto_msgTypes[4]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ListTransactionsResponse.ProtoReflect.Descriptor instead.
|
||||
func (*ListTransactionsResponse) Descriptor() ([]byte, []int) {
|
||||
return file_proto_transaction_v1_transaction_proto_rawDescGZIP(), []int{4}
|
||||
}
|
||||
|
||||
func (x *ListTransactionsResponse) GetTransactions() []*Transaction {
|
||||
if x != nil {
|
||||
return x.Transactions
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type GetTransactionRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
TransactionId int32 `protobuf:"varint,1,opt,name=transaction_id,json=transactionId,proto3" json:"transaction_id,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *GetTransactionRequest) Reset() {
|
||||
*x = GetTransactionRequest{}
|
||||
mi := &file_proto_transaction_v1_transaction_proto_msgTypes[5]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *GetTransactionRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetTransactionRequest) ProtoMessage() {}
|
||||
|
||||
func (x *GetTransactionRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_transaction_v1_transaction_proto_msgTypes[5]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use GetTransactionRequest.ProtoReflect.Descriptor instead.
|
||||
func (*GetTransactionRequest) Descriptor() ([]byte, []int) {
|
||||
return file_proto_transaction_v1_transaction_proto_rawDescGZIP(), []int{5}
|
||||
}
|
||||
|
||||
func (x *GetTransactionRequest) GetTransactionId() int32 {
|
||||
if x != nil {
|
||||
return x.TransactionId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type GetTransactionResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Transaction *Transaction `protobuf:"bytes,1,opt,name=transaction,proto3" json:"transaction,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *GetTransactionResponse) Reset() {
|
||||
*x = GetTransactionResponse{}
|
||||
mi := &file_proto_transaction_v1_transaction_proto_msgTypes[6]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *GetTransactionResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetTransactionResponse) ProtoMessage() {}
|
||||
|
||||
func (x *GetTransactionResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_transaction_v1_transaction_proto_msgTypes[6]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use GetTransactionResponse.ProtoReflect.Descriptor instead.
|
||||
func (*GetTransactionResponse) Descriptor() ([]byte, []int) {
|
||||
return file_proto_transaction_v1_transaction_proto_rawDescGZIP(), []int{6}
|
||||
}
|
||||
|
||||
func (x *GetTransactionResponse) GetTransaction() *Transaction {
|
||||
if x != nil {
|
||||
return x.Transaction
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type DeleteTransactionRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
TransactionId int32 `protobuf:"varint,1,opt,name=transaction_id,json=transactionId,proto3" json:"transaction_id,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *DeleteTransactionRequest) Reset() {
|
||||
*x = DeleteTransactionRequest{}
|
||||
mi := &file_proto_transaction_v1_transaction_proto_msgTypes[7]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *DeleteTransactionRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*DeleteTransactionRequest) ProtoMessage() {}
|
||||
|
||||
func (x *DeleteTransactionRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_transaction_v1_transaction_proto_msgTypes[7]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use DeleteTransactionRequest.ProtoReflect.Descriptor instead.
|
||||
func (*DeleteTransactionRequest) Descriptor() ([]byte, []int) {
|
||||
return file_proto_transaction_v1_transaction_proto_rawDescGZIP(), []int{7}
|
||||
}
|
||||
|
||||
func (x *DeleteTransactionRequest) GetTransactionId() int32 {
|
||||
if x != nil {
|
||||
return x.TransactionId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type DeleteTransactionResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Ok bool `protobuf:"varint,1,opt,name=ok,proto3" json:"ok,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *DeleteTransactionResponse) Reset() {
|
||||
*x = DeleteTransactionResponse{}
|
||||
mi := &file_proto_transaction_v1_transaction_proto_msgTypes[8]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *DeleteTransactionResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*DeleteTransactionResponse) ProtoMessage() {}
|
||||
|
||||
func (x *DeleteTransactionResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_transaction_v1_transaction_proto_msgTypes[8]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use DeleteTransactionResponse.ProtoReflect.Descriptor instead.
|
||||
func (*DeleteTransactionResponse) Descriptor() ([]byte, []int) {
|
||||
return file_proto_transaction_v1_transaction_proto_rawDescGZIP(), []int{8}
|
||||
}
|
||||
|
||||
func (x *DeleteTransactionResponse) GetOk() bool {
|
||||
if x != nil {
|
||||
return x.Ok
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
var File_proto_transaction_v1_transaction_proto protoreflect.FileDescriptor
|
||||
|
||||
const file_proto_transaction_v1_transaction_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
"&proto/transaction/v1/transaction.proto\x12\x14proto.transaction.v1\x1a\x1bbuf/validate/validate.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\xba\x02\n" +
|
||||
"\vTransaction\x12%\n" +
|
||||
"\x0etransaction_id\x18\x01 \x01(\x05R\rtransactionId\x12)\n" +
|
||||
"\vdescription\x18\x02 \x01(\tB\a\xbaH\x04r\x02\x10\x01R\vdescription\x122\n" +
|
||||
"\x06amount\x18\x03 \x01(\tB\x1a\xbaH\x17r\x152\x13^-?\\d+(\\.\\d{1,2})?$R\x06amount\x12#\n" +
|
||||
"\bcategory\x18\x04 \x01(\tB\a\xbaH\x04r\x02\x10\x01R\bcategory\x12E\n" +
|
||||
"\x10transaction_date\x18\x05 \x01(\v2\x1a.google.protobuf.TimestampR\x0ftransactionDate\x129\n" +
|
||||
"\n" +
|
||||
"created_at\x18\x06 \x01(\v2\x1a.google.protobuf.TimestampR\tcreatedAt\"\xe5\x01\n" +
|
||||
"\x18CreateTransactionRequest\x12)\n" +
|
||||
"\vdescription\x18\x01 \x01(\tB\a\xbaH\x04r\x02\x10\x01R\vdescription\x122\n" +
|
||||
"\x06amount\x18\x02 \x01(\tB\x1a\xbaH\x17r\x152\x13^-?\\d+(\\.\\d{1,2})?$R\x06amount\x12#\n" +
|
||||
"\bcategory\x18\x03 \x01(\tB\a\xbaH\x04r\x02\x10\x01R\bcategory\x12E\n" +
|
||||
"\x10transaction_date\x18\x04 \x01(\v2\x1a.google.protobuf.TimestampR\x0ftransactionDate\"`\n" +
|
||||
"\x19CreateTransactionResponse\x12C\n" +
|
||||
"\vtransaction\x18\x01 \x01(\v2!.proto.transaction.v1.TransactionR\vtransaction\"\x19\n" +
|
||||
"\x17ListTransactionsRequest\"a\n" +
|
||||
"\x18ListTransactionsResponse\x12E\n" +
|
||||
"\ftransactions\x18\x01 \x03(\v2!.proto.transaction.v1.TransactionR\ftransactions\"G\n" +
|
||||
"\x15GetTransactionRequest\x12.\n" +
|
||||
"\x0etransaction_id\x18\x01 \x01(\x05B\a\xbaH\x04\x1a\x02 \x00R\rtransactionId\"]\n" +
|
||||
"\x16GetTransactionResponse\x12C\n" +
|
||||
"\vtransaction\x18\x01 \x01(\v2!.proto.transaction.v1.TransactionR\vtransaction\"J\n" +
|
||||
"\x18DeleteTransactionRequest\x12.\n" +
|
||||
"\x0etransaction_id\x18\x01 \x01(\x05B\a\xbaH\x04\x1a\x02 \x00R\rtransactionId\"+\n" +
|
||||
"\x19DeleteTransactionResponse\x12\x0e\n" +
|
||||
"\x02ok\x18\x01 \x01(\bR\x02ok2\xe8\x03\n" +
|
||||
"\x12TransactionService\x12v\n" +
|
||||
"\x11CreateTransaction\x12..proto.transaction.v1.CreateTransactionRequest\x1a/.proto.transaction.v1.CreateTransactionResponse\"\x00\x12s\n" +
|
||||
"\x10ListTransactions\x12-.proto.transaction.v1.ListTransactionsRequest\x1a..proto.transaction.v1.ListTransactionsResponse\"\x00\x12m\n" +
|
||||
"\x0eGetTransaction\x12+.proto.transaction.v1.GetTransactionRequest\x1a,.proto.transaction.v1.GetTransactionResponse\"\x00\x12v\n" +
|
||||
"\x11DeleteTransaction\x12..proto.transaction.v1.DeleteTransactionRequest\x1a/.proto.transaction.v1.DeleteTransactionResponse\"\x00B\xf9\x01\n" +
|
||||
"\x18com.proto.transaction.v1B\x10TransactionProtoP\x01ZYgit.kocoder.xyz/vt/financial-tracking-service/internal/proto/transaction/v1;transactionv1\xa2\x02\x03PTX\xaa\x02\x14Proto.Transaction.V1\xca\x02\x14Proto\\Transaction\\V1\xe2\x02 Proto\\Transaction\\V1\\GPBMetadata\xea\x02\x16Proto::Transaction::V1b\x06proto3"
|
||||
|
||||
var (
|
||||
file_proto_transaction_v1_transaction_proto_rawDescOnce sync.Once
|
||||
file_proto_transaction_v1_transaction_proto_rawDescData []byte
|
||||
)
|
||||
|
||||
func file_proto_transaction_v1_transaction_proto_rawDescGZIP() []byte {
|
||||
file_proto_transaction_v1_transaction_proto_rawDescOnce.Do(func() {
|
||||
file_proto_transaction_v1_transaction_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_proto_transaction_v1_transaction_proto_rawDesc), len(file_proto_transaction_v1_transaction_proto_rawDesc)))
|
||||
})
|
||||
return file_proto_transaction_v1_transaction_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_proto_transaction_v1_transaction_proto_msgTypes = make([]protoimpl.MessageInfo, 9)
|
||||
var file_proto_transaction_v1_transaction_proto_goTypes = []any{
|
||||
(*Transaction)(nil), // 0: proto.transaction.v1.Transaction
|
||||
(*CreateTransactionRequest)(nil), // 1: proto.transaction.v1.CreateTransactionRequest
|
||||
(*CreateTransactionResponse)(nil), // 2: proto.transaction.v1.CreateTransactionResponse
|
||||
(*ListTransactionsRequest)(nil), // 3: proto.transaction.v1.ListTransactionsRequest
|
||||
(*ListTransactionsResponse)(nil), // 4: proto.transaction.v1.ListTransactionsResponse
|
||||
(*GetTransactionRequest)(nil), // 5: proto.transaction.v1.GetTransactionRequest
|
||||
(*GetTransactionResponse)(nil), // 6: proto.transaction.v1.GetTransactionResponse
|
||||
(*DeleteTransactionRequest)(nil), // 7: proto.transaction.v1.DeleteTransactionRequest
|
||||
(*DeleteTransactionResponse)(nil), // 8: proto.transaction.v1.DeleteTransactionResponse
|
||||
(*timestamppb.Timestamp)(nil), // 9: google.protobuf.Timestamp
|
||||
}
|
||||
var file_proto_transaction_v1_transaction_proto_depIdxs = []int32{
|
||||
9, // 0: proto.transaction.v1.Transaction.transaction_date:type_name -> google.protobuf.Timestamp
|
||||
9, // 1: proto.transaction.v1.Transaction.created_at:type_name -> google.protobuf.Timestamp
|
||||
9, // 2: proto.transaction.v1.CreateTransactionRequest.transaction_date:type_name -> google.protobuf.Timestamp
|
||||
0, // 3: proto.transaction.v1.CreateTransactionResponse.transaction:type_name -> proto.transaction.v1.Transaction
|
||||
0, // 4: proto.transaction.v1.ListTransactionsResponse.transactions:type_name -> proto.transaction.v1.Transaction
|
||||
0, // 5: proto.transaction.v1.GetTransactionResponse.transaction:type_name -> proto.transaction.v1.Transaction
|
||||
1, // 6: proto.transaction.v1.TransactionService.CreateTransaction:input_type -> proto.transaction.v1.CreateTransactionRequest
|
||||
3, // 7: proto.transaction.v1.TransactionService.ListTransactions:input_type -> proto.transaction.v1.ListTransactionsRequest
|
||||
5, // 8: proto.transaction.v1.TransactionService.GetTransaction:input_type -> proto.transaction.v1.GetTransactionRequest
|
||||
7, // 9: proto.transaction.v1.TransactionService.DeleteTransaction:input_type -> proto.transaction.v1.DeleteTransactionRequest
|
||||
2, // 10: proto.transaction.v1.TransactionService.CreateTransaction:output_type -> proto.transaction.v1.CreateTransactionResponse
|
||||
4, // 11: proto.transaction.v1.TransactionService.ListTransactions:output_type -> proto.transaction.v1.ListTransactionsResponse
|
||||
6, // 12: proto.transaction.v1.TransactionService.GetTransaction:output_type -> proto.transaction.v1.GetTransactionResponse
|
||||
8, // 13: proto.transaction.v1.TransactionService.DeleteTransaction:output_type -> proto.transaction.v1.DeleteTransactionResponse
|
||||
10, // [10:14] is the sub-list for method output_type
|
||||
6, // [6:10] is the sub-list for method input_type
|
||||
6, // [6:6] is the sub-list for extension type_name
|
||||
6, // [6:6] is the sub-list for extension extendee
|
||||
0, // [0:6] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_proto_transaction_v1_transaction_proto_init() }
|
||||
func file_proto_transaction_v1_transaction_proto_init() {
|
||||
if File_proto_transaction_v1_transaction_proto != nil {
|
||||
return
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_proto_transaction_v1_transaction_proto_rawDesc), len(file_proto_transaction_v1_transaction_proto_rawDesc)),
|
||||
NumEnums: 0,
|
||||
NumMessages: 9,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_proto_transaction_v1_transaction_proto_goTypes,
|
||||
DependencyIndexes: file_proto_transaction_v1_transaction_proto_depIdxs,
|
||||
MessageInfos: file_proto_transaction_v1_transaction_proto_msgTypes,
|
||||
}.Build()
|
||||
File_proto_transaction_v1_transaction_proto = out.File
|
||||
file_proto_transaction_v1_transaction_proto_goTypes = nil
|
||||
file_proto_transaction_v1_transaction_proto_depIdxs = nil
|
||||
}
|
||||
@@ -0,0 +1,213 @@
|
||||
// Code generated by protoc-gen-connect-go. DO NOT EDIT.
|
||||
//
|
||||
// Source: proto/transaction/v1/transaction.proto
|
||||
|
||||
package transactionv1connect
|
||||
|
||||
import (
|
||||
connect "connectrpc.com/connect"
|
||||
context "context"
|
||||
errors "errors"
|
||||
v1 "git.kocoder.xyz/vt/financial-tracking-service/internal/proto/transaction/v1"
|
||||
http "net/http"
|
||||
strings "strings"
|
||||
)
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file and the connect package are
|
||||
// compatible. If you get a compiler error that this constant is not defined, this code was
|
||||
// generated with a version of connect newer than the one compiled into your binary. You can fix the
|
||||
// problem by either regenerating this code with an older version of connect or updating the connect
|
||||
// version compiled into your binary.
|
||||
const _ = connect.IsAtLeastVersion1_13_0
|
||||
|
||||
const (
|
||||
// TransactionServiceName is the fully-qualified name of the TransactionService service.
|
||||
TransactionServiceName = "proto.transaction.v1.TransactionService"
|
||||
)
|
||||
|
||||
// These constants are the fully-qualified names of the RPCs defined in this package. They're
|
||||
// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route.
|
||||
//
|
||||
// Note that these are different from the fully-qualified method names used by
|
||||
// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to
|
||||
// reflection-formatted method names, remove the leading slash and convert the remaining slash to a
|
||||
// period.
|
||||
const (
|
||||
// TransactionServiceCreateTransactionProcedure is the fully-qualified name of the
|
||||
// TransactionService's CreateTransaction RPC.
|
||||
TransactionServiceCreateTransactionProcedure = "/proto.transaction.v1.TransactionService/CreateTransaction"
|
||||
// TransactionServiceListTransactionsProcedure is the fully-qualified name of the
|
||||
// TransactionService's ListTransactions RPC.
|
||||
TransactionServiceListTransactionsProcedure = "/proto.transaction.v1.TransactionService/ListTransactions"
|
||||
// TransactionServiceGetTransactionProcedure is the fully-qualified name of the TransactionService's
|
||||
// GetTransaction RPC.
|
||||
TransactionServiceGetTransactionProcedure = "/proto.transaction.v1.TransactionService/GetTransaction"
|
||||
// TransactionServiceDeleteTransactionProcedure is the fully-qualified name of the
|
||||
// TransactionService's DeleteTransaction RPC.
|
||||
TransactionServiceDeleteTransactionProcedure = "/proto.transaction.v1.TransactionService/DeleteTransaction"
|
||||
)
|
||||
|
||||
// TransactionServiceClient is a client for the proto.transaction.v1.TransactionService service.
|
||||
type TransactionServiceClient interface {
|
||||
CreateTransaction(context.Context, *v1.CreateTransactionRequest) (*v1.CreateTransactionResponse, error)
|
||||
ListTransactions(context.Context, *v1.ListTransactionsRequest) (*v1.ListTransactionsResponse, error)
|
||||
GetTransaction(context.Context, *v1.GetTransactionRequest) (*v1.GetTransactionResponse, error)
|
||||
DeleteTransaction(context.Context, *v1.DeleteTransactionRequest) (*v1.DeleteTransactionResponse, error)
|
||||
}
|
||||
|
||||
// NewTransactionServiceClient constructs a client for the proto.transaction.v1.TransactionService
|
||||
// service. By default, it uses the Connect protocol with the binary Protobuf Codec, asks for
|
||||
// gzipped responses, and sends uncompressed requests. To use the gRPC or gRPC-Web protocols, supply
|
||||
// the connect.WithGRPC() or connect.WithGRPCWeb() options.
|
||||
//
|
||||
// The URL supplied here should be the base URL for the Connect or gRPC server (for example,
|
||||
// http://api.acme.com or https://acme.com/grpc).
|
||||
func NewTransactionServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) TransactionServiceClient {
|
||||
baseURL = strings.TrimRight(baseURL, "/")
|
||||
transactionServiceMethods := v1.File_proto_transaction_v1_transaction_proto.Services().ByName("TransactionService").Methods()
|
||||
return &transactionServiceClient{
|
||||
createTransaction: connect.NewClient[v1.CreateTransactionRequest, v1.CreateTransactionResponse](
|
||||
httpClient,
|
||||
baseURL+TransactionServiceCreateTransactionProcedure,
|
||||
connect.WithSchema(transactionServiceMethods.ByName("CreateTransaction")),
|
||||
connect.WithClientOptions(opts...),
|
||||
),
|
||||
listTransactions: connect.NewClient[v1.ListTransactionsRequest, v1.ListTransactionsResponse](
|
||||
httpClient,
|
||||
baseURL+TransactionServiceListTransactionsProcedure,
|
||||
connect.WithSchema(transactionServiceMethods.ByName("ListTransactions")),
|
||||
connect.WithClientOptions(opts...),
|
||||
),
|
||||
getTransaction: connect.NewClient[v1.GetTransactionRequest, v1.GetTransactionResponse](
|
||||
httpClient,
|
||||
baseURL+TransactionServiceGetTransactionProcedure,
|
||||
connect.WithSchema(transactionServiceMethods.ByName("GetTransaction")),
|
||||
connect.WithClientOptions(opts...),
|
||||
),
|
||||
deleteTransaction: connect.NewClient[v1.DeleteTransactionRequest, v1.DeleteTransactionResponse](
|
||||
httpClient,
|
||||
baseURL+TransactionServiceDeleteTransactionProcedure,
|
||||
connect.WithSchema(transactionServiceMethods.ByName("DeleteTransaction")),
|
||||
connect.WithClientOptions(opts...),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
// transactionServiceClient implements TransactionServiceClient.
|
||||
type transactionServiceClient struct {
|
||||
createTransaction *connect.Client[v1.CreateTransactionRequest, v1.CreateTransactionResponse]
|
||||
listTransactions *connect.Client[v1.ListTransactionsRequest, v1.ListTransactionsResponse]
|
||||
getTransaction *connect.Client[v1.GetTransactionRequest, v1.GetTransactionResponse]
|
||||
deleteTransaction *connect.Client[v1.DeleteTransactionRequest, v1.DeleteTransactionResponse]
|
||||
}
|
||||
|
||||
// CreateTransaction calls proto.transaction.v1.TransactionService.CreateTransaction.
|
||||
func (c *transactionServiceClient) CreateTransaction(ctx context.Context, req *v1.CreateTransactionRequest) (*v1.CreateTransactionResponse, error) {
|
||||
response, err := c.createTransaction.CallUnary(ctx, connect.NewRequest(req))
|
||||
if response != nil {
|
||||
return response.Msg, err
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// ListTransactions calls proto.transaction.v1.TransactionService.ListTransactions.
|
||||
func (c *transactionServiceClient) ListTransactions(ctx context.Context, req *v1.ListTransactionsRequest) (*v1.ListTransactionsResponse, error) {
|
||||
response, err := c.listTransactions.CallUnary(ctx, connect.NewRequest(req))
|
||||
if response != nil {
|
||||
return response.Msg, err
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// GetTransaction calls proto.transaction.v1.TransactionService.GetTransaction.
|
||||
func (c *transactionServiceClient) GetTransaction(ctx context.Context, req *v1.GetTransactionRequest) (*v1.GetTransactionResponse, error) {
|
||||
response, err := c.getTransaction.CallUnary(ctx, connect.NewRequest(req))
|
||||
if response != nil {
|
||||
return response.Msg, err
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// DeleteTransaction calls proto.transaction.v1.TransactionService.DeleteTransaction.
|
||||
func (c *transactionServiceClient) DeleteTransaction(ctx context.Context, req *v1.DeleteTransactionRequest) (*v1.DeleteTransactionResponse, error) {
|
||||
response, err := c.deleteTransaction.CallUnary(ctx, connect.NewRequest(req))
|
||||
if response != nil {
|
||||
return response.Msg, err
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// TransactionServiceHandler is an implementation of the proto.transaction.v1.TransactionService
|
||||
// service.
|
||||
type TransactionServiceHandler interface {
|
||||
CreateTransaction(context.Context, *v1.CreateTransactionRequest) (*v1.CreateTransactionResponse, error)
|
||||
ListTransactions(context.Context, *v1.ListTransactionsRequest) (*v1.ListTransactionsResponse, error)
|
||||
GetTransaction(context.Context, *v1.GetTransactionRequest) (*v1.GetTransactionResponse, error)
|
||||
DeleteTransaction(context.Context, *v1.DeleteTransactionRequest) (*v1.DeleteTransactionResponse, error)
|
||||
}
|
||||
|
||||
// NewTransactionServiceHandler builds an HTTP handler from the service implementation. It returns
|
||||
// the path on which to mount the handler and the handler itself.
|
||||
//
|
||||
// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf
|
||||
// and JSON codecs. They also support gzip compression.
|
||||
func NewTransactionServiceHandler(svc TransactionServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) {
|
||||
transactionServiceMethods := v1.File_proto_transaction_v1_transaction_proto.Services().ByName("TransactionService").Methods()
|
||||
transactionServiceCreateTransactionHandler := connect.NewUnaryHandlerSimple(
|
||||
TransactionServiceCreateTransactionProcedure,
|
||||
svc.CreateTransaction,
|
||||
connect.WithSchema(transactionServiceMethods.ByName("CreateTransaction")),
|
||||
connect.WithHandlerOptions(opts...),
|
||||
)
|
||||
transactionServiceListTransactionsHandler := connect.NewUnaryHandlerSimple(
|
||||
TransactionServiceListTransactionsProcedure,
|
||||
svc.ListTransactions,
|
||||
connect.WithSchema(transactionServiceMethods.ByName("ListTransactions")),
|
||||
connect.WithHandlerOptions(opts...),
|
||||
)
|
||||
transactionServiceGetTransactionHandler := connect.NewUnaryHandlerSimple(
|
||||
TransactionServiceGetTransactionProcedure,
|
||||
svc.GetTransaction,
|
||||
connect.WithSchema(transactionServiceMethods.ByName("GetTransaction")),
|
||||
connect.WithHandlerOptions(opts...),
|
||||
)
|
||||
transactionServiceDeleteTransactionHandler := connect.NewUnaryHandlerSimple(
|
||||
TransactionServiceDeleteTransactionProcedure,
|
||||
svc.DeleteTransaction,
|
||||
connect.WithSchema(transactionServiceMethods.ByName("DeleteTransaction")),
|
||||
connect.WithHandlerOptions(opts...),
|
||||
)
|
||||
return "/proto.transaction.v1.TransactionService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
switch r.URL.Path {
|
||||
case TransactionServiceCreateTransactionProcedure:
|
||||
transactionServiceCreateTransactionHandler.ServeHTTP(w, r)
|
||||
case TransactionServiceListTransactionsProcedure:
|
||||
transactionServiceListTransactionsHandler.ServeHTTP(w, r)
|
||||
case TransactionServiceGetTransactionProcedure:
|
||||
transactionServiceGetTransactionHandler.ServeHTTP(w, r)
|
||||
case TransactionServiceDeleteTransactionProcedure:
|
||||
transactionServiceDeleteTransactionHandler.ServeHTTP(w, r)
|
||||
default:
|
||||
http.NotFound(w, r)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// UnimplementedTransactionServiceHandler returns CodeUnimplemented from all methods.
|
||||
type UnimplementedTransactionServiceHandler struct{}
|
||||
|
||||
func (UnimplementedTransactionServiceHandler) CreateTransaction(context.Context, *v1.CreateTransactionRequest) (*v1.CreateTransactionResponse, error) {
|
||||
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("proto.transaction.v1.TransactionService.CreateTransaction is not implemented"))
|
||||
}
|
||||
|
||||
func (UnimplementedTransactionServiceHandler) ListTransactions(context.Context, *v1.ListTransactionsRequest) (*v1.ListTransactionsResponse, error) {
|
||||
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("proto.transaction.v1.TransactionService.ListTransactions is not implemented"))
|
||||
}
|
||||
|
||||
func (UnimplementedTransactionServiceHandler) GetTransaction(context.Context, *v1.GetTransactionRequest) (*v1.GetTransactionResponse, error) {
|
||||
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("proto.transaction.v1.TransactionService.GetTransaction is not implemented"))
|
||||
}
|
||||
|
||||
func (UnimplementedTransactionServiceHandler) DeleteTransaction(context.Context, *v1.DeleteTransactionRequest) (*v1.DeleteTransactionResponse, error) {
|
||||
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("proto.transaction.v1.TransactionService.DeleteTransaction is not implemented"))
|
||||
}
|
||||
Reference in New Issue
Block a user