Documentation
¶
Index ¶
- Variables
- func CreateSchema(msg DBReflectMessage) ([]string, error)
- func Delete(msg DBReflectMessage) (string, []any, error)
- func FullTextSearchQuery(input string, additionalFilters ...jargon.Filter) exp.Expression
- func FullTextSearchVectors(docs []*SearchContent, additionalFilters ...jargon.Filter) exp.Expression
- func IndexSchema(msg DBReflectMessage) ([]string, error)
- func Insert(msg DBReflectMessage) (string, []any, error)
- func MarshalNestedRecord(msg DBReflectMessage, opts ...RecordOptionsFunc) (exp.Record, error)
- func Migrations(ctx context.Context, db sqlScanner, msg DBReflectMessage) ([]string, error)
- type Column
- type ColumnExpression
- type DBReflectMessage
- type Descriptor
- type DescriptorFieldOption
- type DescriptorFieldOptionFunc
- type FieldOptions
- func (*FieldOptions) Descriptor() ([]byte, []int)deprecated
- func (x *FieldOptions) GetFullTextType() FieldOptions_FullTextType
- func (x *FieldOptions) GetFullTextWeight() FieldOptions_FullTextWeight
- func (x *FieldOptions) GetMessageBehavoir() FieldOptions_MessageBehavoir
- func (*FieldOptions) ProtoMessage()
- func (x *FieldOptions) ProtoReflect() protoreflect.Message
- func (x *FieldOptions) Reset()
- func (x *FieldOptions) String() string
- type FieldOptions_FullTextType
- func (FieldOptions_FullTextType) Descriptor() protoreflect.EnumDescriptor
- func (x FieldOptions_FullTextType) Enum() *FieldOptions_FullTextType
- func (FieldOptions_FullTextType) EnumDescriptor() ([]byte, []int)deprecated
- func (x FieldOptions_FullTextType) Number() protoreflect.EnumNumber
- func (x FieldOptions_FullTextType) String() string
- func (FieldOptions_FullTextType) Type() protoreflect.EnumType
- type FieldOptions_FullTextWeight
- func (FieldOptions_FullTextWeight) Descriptor() protoreflect.EnumDescriptor
- func (x FieldOptions_FullTextWeight) Enum() *FieldOptions_FullTextWeight
- func (FieldOptions_FullTextWeight) EnumDescriptor() ([]byte, []int)deprecated
- func (x FieldOptions_FullTextWeight) Number() protoreflect.EnumNumber
- func (x FieldOptions_FullTextWeight) String() string
- func (FieldOptions_FullTextWeight) Type() protoreflect.EnumType
- type FieldOptions_MessageBehavoir
- func (FieldOptions_MessageBehavoir) Descriptor() protoreflect.EnumDescriptor
- func (x FieldOptions_MessageBehavoir) Enum() *FieldOptions_MessageBehavoir
- func (FieldOptions_MessageBehavoir) EnumDescriptor() ([]byte, []int)deprecated
- func (x FieldOptions_MessageBehavoir) Number() protoreflect.EnumNumber
- func (x FieldOptions_MessageBehavoir) String() string
- func (FieldOptions_MessageBehavoir) Type() protoreflect.EnumType
- type Index
- type IndexOption
- type IndexOptionsFunc
- type Message
- type MessageOptions
- func (*MessageOptions) Descriptor() ([]byte, []int)deprecated
- func (x *MessageOptions) GetDisabled() bool
- func (x *MessageOptions) GetIndexes() []*MessageOptions_Index
- func (x *MessageOptions) GetNestedOnly() bool
- func (x *MessageOptions) GetTenantIdField() string
- func (*MessageOptions) ProtoMessage()
- func (x *MessageOptions) ProtoReflect() protoreflect.Message
- func (x *MessageOptions) Reset()
- func (x *MessageOptions) String() string
- type MessageOptions_Index
- func (*MessageOptions_Index) Descriptor() ([]byte, []int)deprecated
- func (x *MessageOptions_Index) GetColumns() []string
- func (x *MessageOptions_Index) GetDropped() bool
- func (x *MessageOptions_Index) GetName() string
- func (x *MessageOptions_Index) GetNethod() MessageOptions_Index_IndexMethod
- func (*MessageOptions_Index) ProtoMessage()
- func (x *MessageOptions_Index) ProtoReflect() protoreflect.Message
- func (x *MessageOptions_Index) Reset()
- func (x *MessageOptions_Index) String() string
- type MessageOptions_Index_IndexMethod
- func (MessageOptions_Index_IndexMethod) Descriptor() protoreflect.EnumDescriptor
- func (x MessageOptions_Index_IndexMethod) Enum() *MessageOptions_Index_IndexMethod
- func (MessageOptions_Index_IndexMethod) EnumDescriptor() ([]byte, []int)deprecated
- func (x MessageOptions_Index_IndexMethod) Number() protoreflect.EnumNumber
- func (x MessageOptions_Index_IndexMethod) String() string
- func (MessageOptions_Index_IndexMethod) Type() protoreflect.EnumType
- type QueryOptions
- type RecordOption
- type RecordOptionsFunc
- type SearchContent
Constants ¶
This section is empty.
Variables ¶
var ( MessageOptions_Index_IndexMethod_name = map[int32]string{ 0: "INDEX_METHOD_UNSPECIFIED", 1: "INDEX_METHOD_BTREE", 2: "INDEX_METHOD_GIN", 3: "INDEX_METHOD_BTREE_GIN", } MessageOptions_Index_IndexMethod_value = map[string]int32{ "INDEX_METHOD_UNSPECIFIED": 0, "INDEX_METHOD_BTREE": 1, "INDEX_METHOD_GIN": 2, "INDEX_METHOD_BTREE_GIN": 3, } )
Enum value maps for MessageOptions_Index_IndexMethod.
var ( FieldOptions_FullTextType_name = map[int32]string{ 0: "FULL_TEXT_TYPE_UNSPECIFIED", 1: "FULL_TEXT_TYPE_EXACT", 2: "FULL_TEXT_TYPE_ENGLISH", 3: "FULL_TEXT_TYPE_ENGLISH_LONG", } FieldOptions_FullTextType_value = map[string]int32{ "FULL_TEXT_TYPE_UNSPECIFIED": 0, "FULL_TEXT_TYPE_EXACT": 1, "FULL_TEXT_TYPE_ENGLISH": 2, "FULL_TEXT_TYPE_ENGLISH_LONG": 3, } )
Enum value maps for FieldOptions_FullTextType.
var ( FieldOptions_FullTextWeight_name = map[int32]string{ 0: "FULL_TEXT_WEIGHT_UNSPECIFIED", 1: "FULL_TEXT_WEIGHT_LOW", 2: "FULL_TEXT_WEIGHT_MED", 3: "FULL_TEXT_WEIGHT_HIGH", } FieldOptions_FullTextWeight_value = map[string]int32{ "FULL_TEXT_WEIGHT_UNSPECIFIED": 0, "FULL_TEXT_WEIGHT_LOW": 1, "FULL_TEXT_WEIGHT_MED": 2, "FULL_TEXT_WEIGHT_HIGH": 3, } )
Enum value maps for FieldOptions_FullTextWeight.
var ( FieldOptions_MessageBehavoir_name = map[int32]string{ 0: "MESSAGE_BEHAVOIR_UNSPECIFIED", 1: "MESSAGE_BEHAVOIR_EXPAND", 2: "MESSAGE_BEHAVOIR_OMIT", 3: "MESSAGE_BEHAVOIR_JSONB", } FieldOptions_MessageBehavoir_value = map[string]int32{ "MESSAGE_BEHAVOIR_UNSPECIFIED": 0, "MESSAGE_BEHAVOIR_EXPAND": 1, "MESSAGE_BEHAVOIR_OMIT": 2, "MESSAGE_BEHAVOIR_JSONB": 3, } )
Enum value maps for FieldOptions_MessageBehavoir.
var (
// optional pgdb.v1.MessageOptions msg = 6010;
E_Msg = &file_pgdb_v1_pgdb_proto_extTypes[0]
)
Extension fields to descriptorpb.MessageOptions.
var (
// optional pgdb.v1.FieldOptions options = 6010;
E_Options = &file_pgdb_v1_pgdb_proto_extTypes[1]
)
Extension fields to descriptorpb.FieldOptions.
var File_pgdb_v1_pgdb_proto protoreflect.FileDescriptor
Functions ¶
func CreateSchema ¶
func CreateSchema(msg DBReflectMessage) ([]string, error)
func FullTextSearchQuery ¶
func FullTextSearchQuery(input string, additionalFilters ...jargon.Filter) exp.Expression
func FullTextSearchVectors ¶
func FullTextSearchVectors(docs []*SearchContent, additionalFilters ...jargon.Filter) exp.Expression
FullTextSearchVectors converts a set of input documents into a ::tsvector. Note: this function may generally ignore errors in input text, to be robust to untrusted inputs, and will do its "best", for some value of "best".
func IndexSchema ¶
func IndexSchema(msg DBReflectMessage) ([]string, error)
func MarshalNestedRecord ¶
func MarshalNestedRecord(msg DBReflectMessage, opts ...RecordOptionsFunc) (exp.Record, error)
func Migrations ¶
func Migrations(ctx context.Context, db sqlScanner, msg DBReflectMessage) ([]string, error)
Types ¶
type Column ¶
type Column struct { Table string Name string Type string Nullable bool OverrideExpression string Default string }
func (*Column) Identifier ¶ added in v0.1.17
func (x *Column) Identifier() exp.IdentifierExpression
type ColumnExpression ¶ added in v0.1.17
type ColumnExpression interface {
Identifier() exp.IdentifierExpression
}
type DBReflectMessage ¶
type DBReflectMessage interface {
DBReflect() Message
}
type Descriptor ¶
type Descriptor interface { TableName() string Fields(opts ...DescriptorFieldOptionFunc) []*Column PKSKField() *Column DataField() *Column SearchField() *Column VersioningField() *Column TenantField() *Column Indexes(opts ...IndexOptionsFunc) []*Index IndexPrimaryKey(opts ...IndexOptionsFunc) *Index }
Descriptor is the same for all instances of a Message.
type DescriptorFieldOption ¶
func NewDescriptorFieldOption ¶
func NewDescriptorFieldOption(opts []DescriptorFieldOptionFunc) *DescriptorFieldOption
func (*DescriptorFieldOption) ColumnName ¶
func (r *DescriptorFieldOption) ColumnName(in string) string
func (*DescriptorFieldOption) Nested ¶
func (r *DescriptorFieldOption) Nested(prefix string) []DescriptorFieldOptionFunc
func (DescriptorFieldOption) Nullable ¶ added in v0.1.14
func (dfo DescriptorFieldOption) Nullable(defaultValue bool) bool
type DescriptorFieldOptionFunc ¶
type DescriptorFieldOptionFunc func(option *DescriptorFieldOption)
func DescriptorFieldNested ¶ added in v0.1.7
func DescriptorFieldNested(b bool) DescriptorFieldOptionFunc
func DescriptorFieldPrefix ¶
func DescriptorFieldPrefix(prefix string) DescriptorFieldOptionFunc
type FieldOptions ¶
type FieldOptions struct { FullTextType FieldOptions_FullTextType `` /* 139-byte string literal not displayed */ FullTextWeight FieldOptions_FullTextWeight `` /* 147-byte string literal not displayed */ MessageBehavoir FieldOptions_MessageBehavoir `` /* 149-byte string literal not displayed */ // contains filtered or unexported fields }
func (*FieldOptions) Descriptor
deprecated
func (*FieldOptions) Descriptor() ([]byte, []int)
Deprecated: Use FieldOptions.ProtoReflect.Descriptor instead.
func (*FieldOptions) GetFullTextType ¶
func (x *FieldOptions) GetFullTextType() FieldOptions_FullTextType
func (*FieldOptions) GetFullTextWeight ¶
func (x *FieldOptions) GetFullTextWeight() FieldOptions_FullTextWeight
func (*FieldOptions) GetMessageBehavoir ¶
func (x *FieldOptions) GetMessageBehavoir() FieldOptions_MessageBehavoir
func (*FieldOptions) ProtoMessage ¶
func (*FieldOptions) ProtoMessage()
func (*FieldOptions) ProtoReflect ¶
func (x *FieldOptions) ProtoReflect() protoreflect.Message
func (*FieldOptions) Reset ¶
func (x *FieldOptions) Reset()
func (*FieldOptions) String ¶
func (x *FieldOptions) String() string
type FieldOptions_FullTextType ¶
type FieldOptions_FullTextType int32
const ( FieldOptions_FULL_TEXT_TYPE_UNSPECIFIED FieldOptions_FullTextType = 0 FieldOptions_FULL_TEXT_TYPE_EXACT FieldOptions_FullTextType = 1 // Best used for short display names FieldOptions_FULL_TEXT_TYPE_ENGLISH FieldOptions_FullTextType = 2 // Removes short-tokens (<3 chars), useful for descirptions FieldOptions_FULL_TEXT_TYPE_ENGLISH_LONG FieldOptions_FullTextType = 3 )
func (FieldOptions_FullTextType) Descriptor ¶
func (FieldOptions_FullTextType) Descriptor() protoreflect.EnumDescriptor
func (FieldOptions_FullTextType) Enum ¶
func (x FieldOptions_FullTextType) Enum() *FieldOptions_FullTextType
func (FieldOptions_FullTextType) EnumDescriptor
deprecated
func (FieldOptions_FullTextType) EnumDescriptor() ([]byte, []int)
Deprecated: Use FieldOptions_FullTextType.Descriptor instead.
func (FieldOptions_FullTextType) Number ¶
func (x FieldOptions_FullTextType) Number() protoreflect.EnumNumber
func (FieldOptions_FullTextType) String ¶
func (x FieldOptions_FullTextType) String() string
func (FieldOptions_FullTextType) Type ¶
func (FieldOptions_FullTextType) Type() protoreflect.EnumType
type FieldOptions_FullTextWeight ¶
type FieldOptions_FullTextWeight int32
const ( FieldOptions_FULL_TEXT_WEIGHT_UNSPECIFIED FieldOptions_FullTextWeight = 0 FieldOptions_FULL_TEXT_WEIGHT_LOW FieldOptions_FullTextWeight = 1 FieldOptions_FULL_TEXT_WEIGHT_MED FieldOptions_FullTextWeight = 2 FieldOptions_FULL_TEXT_WEIGHT_HIGH FieldOptions_FullTextWeight = 3 )
func (FieldOptions_FullTextWeight) Descriptor ¶
func (FieldOptions_FullTextWeight) Descriptor() protoreflect.EnumDescriptor
func (FieldOptions_FullTextWeight) Enum ¶
func (x FieldOptions_FullTextWeight) Enum() *FieldOptions_FullTextWeight
func (FieldOptions_FullTextWeight) EnumDescriptor
deprecated
func (FieldOptions_FullTextWeight) EnumDescriptor() ([]byte, []int)
Deprecated: Use FieldOptions_FullTextWeight.Descriptor instead.
func (FieldOptions_FullTextWeight) Number ¶
func (x FieldOptions_FullTextWeight) Number() protoreflect.EnumNumber
func (FieldOptions_FullTextWeight) String ¶
func (x FieldOptions_FullTextWeight) String() string
func (FieldOptions_FullTextWeight) Type ¶
func (FieldOptions_FullTextWeight) Type() protoreflect.EnumType
type FieldOptions_MessageBehavoir ¶
type FieldOptions_MessageBehavoir int32
const ( FieldOptions_MESSAGE_BEHAVOIR_UNSPECIFIED FieldOptions_MessageBehavoir = 0 FieldOptions_MESSAGE_BEHAVOIR_EXPAND FieldOptions_MessageBehavoir = 1 FieldOptions_MESSAGE_BEHAVOIR_OMIT FieldOptions_MessageBehavoir = 2 FieldOptions_MESSAGE_BEHAVOIR_JSONB FieldOptions_MessageBehavoir = 3 )
func (FieldOptions_MessageBehavoir) Descriptor ¶
func (FieldOptions_MessageBehavoir) Descriptor() protoreflect.EnumDescriptor
func (FieldOptions_MessageBehavoir) Enum ¶
func (x FieldOptions_MessageBehavoir) Enum() *FieldOptions_MessageBehavoir
func (FieldOptions_MessageBehavoir) EnumDescriptor
deprecated
func (FieldOptions_MessageBehavoir) EnumDescriptor() ([]byte, []int)
Deprecated: Use FieldOptions_MessageBehavoir.Descriptor instead.
func (FieldOptions_MessageBehavoir) Number ¶
func (x FieldOptions_MessageBehavoir) Number() protoreflect.EnumNumber
func (FieldOptions_MessageBehavoir) String ¶
func (x FieldOptions_MessageBehavoir) String() string
func (FieldOptions_MessageBehavoir) Type ¶
func (FieldOptions_MessageBehavoir) Type() protoreflect.EnumType
type Index ¶
type Index struct { Name string // only one index can be set to IsPrimary IsPrimary bool IsUnique bool // this indivates the Index by this name MAY be dropped, once in IsDropped state, other fields may be empty. IsDropped bool Method MessageOptions_Index_IndexMethod Columns []string // OverrideExpression if set, this string is used to render indexes contents, instead of the Columns list. OverrideExpression string WherePredicate string }
type IndexOption ¶
func NewIndexOptions ¶
func NewIndexOptions(opts []IndexOptionsFunc) *IndexOption
func (*IndexOption) ColumnName ¶
func (r *IndexOption) ColumnName(in string) string
func (*IndexOption) IndexName ¶
func (r *IndexOption) IndexName(in string) string
func (*IndexOption) Nested ¶
func (r *IndexOption) Nested(prefix string) []IndexOptionsFunc
type IndexOptionsFunc ¶
type IndexOptionsFunc func(option *IndexOption)
func IndexOptionColumnPrefix ¶
func IndexOptionColumnPrefix(prefix string) IndexOptionsFunc
func IndexOptionIndexPrefix ¶
func IndexOptionIndexPrefix(prefix string) IndexOptionsFunc
func IndexOptionIsNested ¶ added in v0.1.7
func IndexOptionIsNested(b bool) IndexOptionsFunc
type Message ¶
type Message interface { Descriptor() Descriptor Record(opts ...RecordOptionsFunc) (exp.Record, error) SearchData(opts ...RecordOptionsFunc) []*SearchContent }
type MessageOptions ¶
type MessageOptions struct { Disabled bool `protobuf:"varint,1,opt,name=disabled,proto3" json:"disabled,omitempty"` Indexes []*MessageOptions_Index `protobuf:"bytes,2,rep,name=indexes,proto3" json:"indexes,omitempty"` // defaults to `tenant_id`. Must be set if an object does not have a // `tenant_id` field. TenantIdField string `protobuf:"bytes,3,opt,name=tenant_id_field,json=tenantIdField,proto3" json:"tenant_id_field,omitempty"` // if this message is only used in nested messages, a subset of methods // will be generated. NestedOnly bool `protobuf:"varint,4,opt,name=nested_only,json=nestedOnly,proto3" json:"nested_only,omitempty"` // contains filtered or unexported fields }
func (*MessageOptions) Descriptor
deprecated
func (*MessageOptions) Descriptor() ([]byte, []int)
Deprecated: Use MessageOptions.ProtoReflect.Descriptor instead.
func (*MessageOptions) GetDisabled ¶
func (x *MessageOptions) GetDisabled() bool
func (*MessageOptions) GetIndexes ¶
func (x *MessageOptions) GetIndexes() []*MessageOptions_Index
func (*MessageOptions) GetNestedOnly ¶
func (x *MessageOptions) GetNestedOnly() bool
func (*MessageOptions) GetTenantIdField ¶
func (x *MessageOptions) GetTenantIdField() string
func (*MessageOptions) ProtoMessage ¶
func (*MessageOptions) ProtoMessage()
func (*MessageOptions) ProtoReflect ¶
func (x *MessageOptions) ProtoReflect() protoreflect.Message
func (*MessageOptions) Reset ¶
func (x *MessageOptions) Reset()
func (*MessageOptions) String ¶
func (x *MessageOptions) String() string
type MessageOptions_Index ¶
type MessageOptions_Index struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` Nethod MessageOptions_Index_IndexMethod `protobuf:"varint,2,opt,name=nethod,proto3,enum=pgdb.v1.MessageOptions_Index_IndexMethod" json:"nethod,omitempty"` Columns []string `protobuf:"bytes,3,rep,name=columns,proto3" json:"columns,omitempty"` // used to indicate the index by this name can be dropped Dropped bool `protobuf:"varint,4,opt,name=dropped,proto3" json:"dropped,omitempty"` // contains filtered or unexported fields }
func (*MessageOptions_Index) Descriptor
deprecated
func (*MessageOptions_Index) Descriptor() ([]byte, []int)
Deprecated: Use MessageOptions_Index.ProtoReflect.Descriptor instead.
func (*MessageOptions_Index) GetColumns ¶
func (x *MessageOptions_Index) GetColumns() []string
func (*MessageOptions_Index) GetDropped ¶
func (x *MessageOptions_Index) GetDropped() bool
func (*MessageOptions_Index) GetName ¶
func (x *MessageOptions_Index) GetName() string
func (*MessageOptions_Index) GetNethod ¶
func (x *MessageOptions_Index) GetNethod() MessageOptions_Index_IndexMethod
func (*MessageOptions_Index) ProtoMessage ¶
func (*MessageOptions_Index) ProtoMessage()
func (*MessageOptions_Index) ProtoReflect ¶
func (x *MessageOptions_Index) ProtoReflect() protoreflect.Message
func (*MessageOptions_Index) Reset ¶
func (x *MessageOptions_Index) Reset()
func (*MessageOptions_Index) String ¶
func (x *MessageOptions_Index) String() string
type MessageOptions_Index_IndexMethod ¶
type MessageOptions_Index_IndexMethod int32
const ( MessageOptions_Index_INDEX_METHOD_UNSPECIFIED MessageOptions_Index_IndexMethod = 0 MessageOptions_Index_INDEX_METHOD_BTREE MessageOptions_Index_IndexMethod = 1 MessageOptions_Index_INDEX_METHOD_GIN MessageOptions_Index_IndexMethod = 2 // Requires loading of BTREE_GIN extension: // https://www.postgresql.org/docs/current/btree-gin.html MessageOptions_Index_INDEX_METHOD_BTREE_GIN MessageOptions_Index_IndexMethod = 3 )
func (MessageOptions_Index_IndexMethod) Descriptor ¶
func (MessageOptions_Index_IndexMethod) Descriptor() protoreflect.EnumDescriptor
func (MessageOptions_Index_IndexMethod) Enum ¶
func (x MessageOptions_Index_IndexMethod) Enum() *MessageOptions_Index_IndexMethod
func (MessageOptions_Index_IndexMethod) EnumDescriptor
deprecated
func (MessageOptions_Index_IndexMethod) EnumDescriptor() ([]byte, []int)
Deprecated: Use MessageOptions_Index_IndexMethod.Descriptor instead.
func (MessageOptions_Index_IndexMethod) Number ¶
func (x MessageOptions_Index_IndexMethod) Number() protoreflect.EnumNumber
func (MessageOptions_Index_IndexMethod) String ¶
func (x MessageOptions_Index_IndexMethod) String() string
func (MessageOptions_Index_IndexMethod) Type ¶
func (MessageOptions_Index_IndexMethod) Type() protoreflect.EnumType
type RecordOption ¶
func NewRecordOptions ¶
func NewRecordOptions(opts []RecordOptionsFunc) *RecordOption
func (*RecordOption) ColumnName ¶
func (r *RecordOption) ColumnName(in string) string
func (*RecordOption) Nested ¶
func (r *RecordOption) Nested(prefix string) []RecordOptionsFunc
type RecordOptionsFunc ¶
type RecordOptionsFunc func(option *RecordOption)
func RecordOptionIsNested ¶ added in v0.1.7
func RecordOptionIsNested(b bool) RecordOptionsFunc
func RecordOptionNulled ¶ added in v0.1.14
func RecordOptionNulled(b bool) RecordOptionsFunc
func RecordOptionPrefix ¶
func RecordOptionPrefix(prefix string) RecordOptionsFunc
type SearchContent ¶
type SearchContent struct { Type FieldOptions_FullTextType Weight FieldOptions_FullTextWeight Value interface{} }