persist

package
v4.3.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 30, 2020 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var E_MappedField = &proto.ExtensionDesc{
	ExtendedType:  (*descriptor.FieldOptions)(nil),
	ExtensionType: (*bool)(nil),
	Field:         560006,
	Name:          "persist.mapped_field",
	Tag:           "varint,560006,opt,name=mapped_field",
	Filename:      "persist/options.proto",
}
View Source
var E_Mapping = &proto.ExtensionDesc{
	ExtendedType:  (*descriptor.ServiceOptions)(nil),
	ExtensionType: (*TypeMapping)(nil),
	Field:         560001,
	Name:          "persist.mapping",
	Tag:           "bytes,560001,opt,name=mapping",
	Filename:      "persist/options.proto",
}
View Source
var E_Opts = &proto.ExtensionDesc{
	ExtendedType:  (*descriptor.MethodOptions)(nil),
	ExtensionType: (*MOpts)(nil),
	Field:         560004,
	Name:          "persist.opts",
	Tag:           "bytes,560004,opt,name=opts",
	Filename:      "persist/options.proto",
}
View Source
var E_Pkg = &proto.ExtensionDesc{
	ExtendedType:  (*descriptor.FileOptions)(nil),
	ExtensionType: (*string)(nil),
	Field:         560003,
	Name:          "persist.pkg",
	Tag:           "bytes,560003,opt,name=pkg",
	Filename:      "persist/options.proto",
}
View Source
var E_Ql = &proto.ExtensionDesc{
	ExtendedType:  (*descriptor.ServiceOptions)(nil),
	ExtensionType: (*QueryOpts)(nil),
	Field:         560000,
	Name:          "persist.ql",
	Tag:           "bytes,560000,opt,name=ql",
	Filename:      "persist/options.proto",
}
View Source
var E_ServiceType = &proto.ExtensionDesc{
	ExtendedType:  (*descriptor.ServiceOptions)(nil),
	ExtensionType: (*PersistenceOptions)(nil),
	Field:         560002,
	Name:          "persist.service_type",
	Tag:           "varint,560002,opt,name=service_type,enum=persist.PersistenceOptions",
	Filename:      "persist/options.proto",
}
View Source
var PersistenceOptions_name = map[int32]string{
	0: "SQL",
	1: "SPANNER",
}
View Source
var PersistenceOptions_value = map[string]int32{
	"SQL":     0,
	"SPANNER": 1,
}

Functions

This section is empty.

Types

type MOpts

type MOpts struct {
	// must match a name of a QLImpl query in the service.
	Query *string `protobuf:"bytes,1,req,name=query" json:"query,omitempty"`
	// the before function will be called before running any sql code for
	// every input data element and if the return will be not empty/nil and
	// the error will be nil the data returned by this function will be
	// returned by the function skipping the code execution
	Before *bool `protobuf:"varint,10,opt,name=before" json:"before,omitempty"`
	// the after function will be called after running any sql code for
	// every output data element, the return data of this function will be ignored
	After                *bool    `protobuf:"varint,11,opt,name=after" json:"after,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*MOpts) Descriptor

func (*MOpts) Descriptor() ([]byte, []int)

func (*MOpts) GetAfter

func (m *MOpts) GetAfter() bool

func (*MOpts) GetBefore

func (m *MOpts) GetBefore() bool

func (*MOpts) GetQuery

func (m *MOpts) GetQuery() string

func (*MOpts) ProtoMessage

func (*MOpts) ProtoMessage()

func (*MOpts) Reset

func (m *MOpts) Reset()

func (*MOpts) String

func (m *MOpts) String() string

func (*MOpts) XXX_DiscardUnknown

func (m *MOpts) XXX_DiscardUnknown()

func (*MOpts) XXX_Marshal

func (m *MOpts) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*MOpts) XXX_Merge

func (m *MOpts) XXX_Merge(src proto.Message)

func (*MOpts) XXX_Size

func (m *MOpts) XXX_Size() int

func (*MOpts) XXX_Unmarshal

func (m *MOpts) XXX_Unmarshal(b []byte) error

type NotFound

type NotFound struct {
	Msg string
}

func (NotFound) Error

func (n NotFound) Error() string

type PersistTx

type PersistTx interface {
	Commit() error
	Rollback() error
	Runnable
}

type PersistenceOptions

type PersistenceOptions int32
const (
	// SQL Query
	PersistenceOptions_SQL     PersistenceOptions = 0
	PersistenceOptions_SPANNER PersistenceOptions = 1
)

func (PersistenceOptions) Enum

func (PersistenceOptions) EnumDescriptor

func (PersistenceOptions) EnumDescriptor() ([]byte, []int)

func (PersistenceOptions) String

func (x PersistenceOptions) String() string

func (*PersistenceOptions) UnmarshalJSON

func (x *PersistenceOptions) UnmarshalJSON(data []byte) error

type QLImpl

type QLImpl struct {
	// the query string with numeric placeholders for parameters
	// its an array to allow the query to span across multiple lines but it
	// will be joined and used as a single sql query string at generation time
	Query []string `protobuf:"bytes,1,rep,name=query" json:"query,omitempty"`
	// if provided, persist will rewrite the query string in the generated code
	// replacing "@field_name" (no quotes) with "?" or "$<position>"
	// if unprovided, persist will not rewrite the query string
	PmStrategy *string `protobuf:"bytes,2,opt,name=pm_strategy,json=pmStrategy" json:"pm_strategy,omitempty"`
	// name of this query.  must be unique to the service.
	Name *string `protobuf:"bytes,3,req,name=name" json:"name,omitempty"`
	// the message type that matches the parameters
	// Input rpc messages will be converted to this type
	// they will be used in the parameters in the query
	// The INTERFACE of this message will be used for parameters
	// in the generated query function.
	// if absent, this query takes no  parameters.
	// The query does not have to use all the fields of this type as parameters,
	// but it cannot use any parameter NOT listed here.
	In *string `protobuf:"bytes,4,opt,name=in" json:"in,omitempty"`
	// the message type that matches what the query returns.
	// This entity message will be converted to the output type
	// input/output messages on rpc calls will have their fields ignored if they
	// don't match this entity.
	// the generated query function will return this message type
	// if absent, this query returns nothing, and .
	// The query does not have to return a fully populated message,
	// but additional rows returned from the query that do NOT exist on
	// the out message will be ignored.
	Out                  *string  `protobuf:"bytes,5,opt,name=out" json:"out,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*QLImpl) Descriptor

func (*QLImpl) Descriptor() ([]byte, []int)

func (*QLImpl) GetIn

func (m *QLImpl) GetIn() string

func (*QLImpl) GetName

func (m *QLImpl) GetName() string

func (*QLImpl) GetOut

func (m *QLImpl) GetOut() string

func (*QLImpl) GetPmStrategy

func (m *QLImpl) GetPmStrategy() string

func (*QLImpl) GetQuery

func (m *QLImpl) GetQuery() []string

func (*QLImpl) ProtoMessage

func (*QLImpl) ProtoMessage()

func (*QLImpl) Reset

func (m *QLImpl) Reset()

func (*QLImpl) String

func (m *QLImpl) String() string

func (*QLImpl) XXX_DiscardUnknown

func (m *QLImpl) XXX_DiscardUnknown()

func (*QLImpl) XXX_Marshal

func (m *QLImpl) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*QLImpl) XXX_Merge

func (m *QLImpl) XXX_Merge(src proto.Message)

func (*QLImpl) XXX_Size

func (m *QLImpl) XXX_Size() int

func (*QLImpl) XXX_Unmarshal

func (m *QLImpl) XXX_Unmarshal(b []byte) error

type QueryOpts

type QueryOpts struct {
	Queries              []*QLImpl `protobuf:"bytes,1,rep,name=queries" json:"queries,omitempty"`
	XXX_NoUnkeyedLiteral struct{}  `json:"-"`
	XXX_unrecognized     []byte    `json:"-"`
	XXX_sizecache        int32     `json:"-"`
}

func (*QueryOpts) Descriptor

func (*QueryOpts) Descriptor() ([]byte, []int)

func (*QueryOpts) GetQueries

func (m *QueryOpts) GetQueries() []*QLImpl

func (*QueryOpts) ProtoMessage

func (*QueryOpts) ProtoMessage()

func (*QueryOpts) Reset

func (m *QueryOpts) Reset()

func (*QueryOpts) String

func (m *QueryOpts) String() string

func (*QueryOpts) XXX_DiscardUnknown

func (m *QueryOpts) XXX_DiscardUnknown()

func (*QueryOpts) XXX_Marshal

func (m *QueryOpts) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*QueryOpts) XXX_Merge

func (m *QueryOpts) XXX_Merge(src proto.Message)

func (*QueryOpts) XXX_Size

func (m *QueryOpts) XXX_Size() int

func (*QueryOpts) XXX_Unmarshal

func (m *QueryOpts) XXX_Unmarshal(b []byte) error

type Runnable

type Runnable interface {
	QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
	ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
}

type SpannerRunnable

type SpannerRunnable interface {
	QueryWithStats(context.Context, spanner.Statement) *spanner.RowIterator
}

type SpannerScanValuer

type SpannerScanValuer interface {
	SpannerScanner
	SpannerValuer
}

type SpannerScanner

type SpannerScanner interface {
	SpannerScan(*spanner.GenericColumnValue) error
}

type SpannerValuer

type SpannerValuer interface {
	SpannerValue() (interface{}, error)
}

type TypeMapping

type TypeMapping struct {
	Types                []*TypeMapping_TypeDescriptor `protobuf:"bytes,1,rep,name=types" json:"types,omitempty"`
	XXX_NoUnkeyedLiteral struct{}                      `json:"-"`
	XXX_unrecognized     []byte                        `json:"-"`
	XXX_sizecache        int32                         `json:"-"`
}

func (*TypeMapping) Descriptor

func (*TypeMapping) Descriptor() ([]byte, []int)

func (*TypeMapping) GetTypes

func (m *TypeMapping) GetTypes() []*TypeMapping_TypeDescriptor

func (*TypeMapping) ProtoMessage

func (*TypeMapping) ProtoMessage()

func (*TypeMapping) Reset

func (m *TypeMapping) Reset()

func (*TypeMapping) String

func (m *TypeMapping) String() string

func (*TypeMapping) XXX_DiscardUnknown

func (m *TypeMapping) XXX_DiscardUnknown()

func (*TypeMapping) XXX_Marshal

func (m *TypeMapping) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*TypeMapping) XXX_Merge

func (m *TypeMapping) XXX_Merge(src proto.Message)

func (*TypeMapping) XXX_Size

func (m *TypeMapping) XXX_Size() int

func (*TypeMapping) XXX_Unmarshal

func (m *TypeMapping) XXX_Unmarshal(b []byte) error

type TypeMapping_TypeDescriptor

type TypeMapping_TypeDescriptor struct {
	// if this is not setup the proto_type must be one of the built-in types
	ProtoTypeName *string `protobuf:"bytes,1,opt,name=proto_type_name,json=protoTypeName" json:"proto_type_name,omitempty"`
	// If proto_type_name is set, this need not be set.  If both this and proto_type_name
	// are set, this must be one of TYPE_ENUM, TYPE_MESSAGE
	// TYPE_GROUP is not supported
	ProtoType *descriptor.FieldDescriptorProto_Type `` /* 129-byte string literal not displayed */
	// if proto_label is not setup we consider any option except LABAEL_REPEATED
	ProtoLabel           *descriptor.FieldDescriptorProto_Label `` /* 133-byte string literal not displayed */
	XXX_NoUnkeyedLiteral struct{}                               `json:"-"`
	XXX_unrecognized     []byte                                 `json:"-"`
	XXX_sizecache        int32                                  `json:"-"`
}

func (*TypeMapping_TypeDescriptor) Descriptor

func (*TypeMapping_TypeDescriptor) Descriptor() ([]byte, []int)

func (*TypeMapping_TypeDescriptor) GetProtoLabel

func (*TypeMapping_TypeDescriptor) GetProtoType

func (*TypeMapping_TypeDescriptor) GetProtoTypeName

func (m *TypeMapping_TypeDescriptor) GetProtoTypeName() string

func (*TypeMapping_TypeDescriptor) ProtoMessage

func (*TypeMapping_TypeDescriptor) ProtoMessage()

func (*TypeMapping_TypeDescriptor) Reset

func (m *TypeMapping_TypeDescriptor) Reset()

func (*TypeMapping_TypeDescriptor) String

func (m *TypeMapping_TypeDescriptor) String() string

func (*TypeMapping_TypeDescriptor) XXX_DiscardUnknown

func (m *TypeMapping_TypeDescriptor) XXX_DiscardUnknown()

func (*TypeMapping_TypeDescriptor) XXX_Marshal

func (m *TypeMapping_TypeDescriptor) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*TypeMapping_TypeDescriptor) XXX_Merge

func (m *TypeMapping_TypeDescriptor) XXX_Merge(src proto.Message)

func (*TypeMapping_TypeDescriptor) XXX_Size

func (m *TypeMapping_TypeDescriptor) XXX_Size() int

func (*TypeMapping_TypeDescriptor) XXX_Unmarshal

func (m *TypeMapping_TypeDescriptor) XXX_Unmarshal(b []byte) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL