Documentation
¶
Index ¶
- func IsPathSortable(path *Path) bool
- func WalkPathNodes(rootMessage *j5schema.ObjectSchema, callback func(Path) error) error
- type AuthProvider
- type AuthProviderFunc
- type Column
- type GetJoinSpec
- type GetRequest
- type GetResponse
- type GetSpec
- type Getter
- type JSONPathSpec
- type JoinField
- type JoinFields
- type LeftJoin
- type ListReflectionSet
- type ListRequest
- type ListResponse
- type ListRules
- type ListSpec
- type Lister
- type NestedField
- type Path
- func (pp Path) Child(name string) (*Path, error)
- func (pp Path) ClientPath() string
- func (pp Path) DebugName() string
- func (pp *Path) GetValue(msg j5reflect.Object) (any, bool, error)
- func (pp Path) IDPath() string
- func (pp *Path) JSONBArrowPath() string
- func (pp *Path) JSONPathQuery() string
- func (pp Path) LeafField() *j5schema.ObjectProperty
- func (pp Path) LeafOneof() *j5schema.OneofSchema
- func (pp Path) Root() *j5schema.ObjectSchema
- func (pp Path) WalkPathNodes(callback func(*j5schema.ObjectProperty) bool)
- type ProtoField
- type ProtoPathSpec
- type Query
- type QueryLogger
- type TSVColumn
- type Table
- type TableReflectionSet
- type TableSpec
- type Transactor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsPathSortable ¶
func WalkPathNodes ¶
func WalkPathNodes(rootMessage *j5schema.ObjectSchema, callback func(Path) error) error
WalkPathNodes visits every field in the message tree other than the root message itself, calling the callback for each.
Types ¶
type AuthProvider ¶
type AuthProviderFunc ¶
func (AuthProviderFunc) AuthFilter ¶
type GetJoinSpec ¶
type GetJoinSpec struct {
TableName string
DataColumn string
On JoinFields
FieldInParent string
}
type GetRequest ¶
type GetResponse ¶
type GetSpec ¶
type GetSpec struct {
Method *j5schema.MethodSchema
TableName string
DataColumn string
Auth AuthProvider
AuthJoin []*LeftJoin
PrimaryKey func(j5reflect.Object) (map[string]any, error)
StateResponseField string
Join *GetJoinSpec
}
type Getter ¶
type Getter struct {
// contains filtered or unexported fields
}
func (*Getter) SetQueryLogger ¶
func (gc *Getter) SetQueryLogger(logger QueryLogger)
type JSONPathSpec ¶
type JSONPathSpec []string
Like ProtoPathSpec but uses JSON field names
func JSONPath ¶
func JSONPath(path ...string) JSONPathSpec
func ParseJSONPathSpec ¶
func ParseJSONPathSpec(path string) JSONPathSpec
func (JSONPathSpec) String ¶
func (jp JSONPathSpec) String() string
type JoinField ¶
type JoinField struct {
JoinColumn string // The name of the column in the table being introduced
RootColumn string // The name of the column in the root table
}
JoinConstraint defines a LEFT JOIN <JoinTable> ON <JoinTable>.<JoinColumn> = <RootTable>.<RootColumn>
type JoinFields ¶
type JoinFields []JoinField
func (JoinFields) Reverse ¶
func (jc JoinFields) Reverse() JoinFields
type LeftJoin ¶
type LeftJoin struct {
TableName string
On JoinFields
}
LeftJoin is a specification for joining in the form <TableName> ON <TableName>.<JoinKeyColumn> = <Main>.<MainKeyColumn> Main is defined in the outer struct holding this LeftJoin
type ListReflectionSet ¶
type ListReflectionSet struct {
TableReflectionSet
RequestFilterFields []*j5schema.ObjectProperty
// contains filtered or unexported fields
}
func BuildListReflection ¶
func BuildListReflection(method *j5schema.MethodSchema, table TableSpec) (*ListReflectionSet, error)
type ListRequest ¶
type ListResponse ¶
type ListRules ¶
type ListRules struct {
Sort *list_j5pb.SortingConstraint
Filter *list_j5pb.FilteringConstraint
Search *list_j5pb.SearchingConstraint
}
func FieldListRules ¶
type ListSpec ¶
type Lister ¶
type Lister struct {
ListReflectionSet
// contains filtered or unexported fields
}
func (*Lister) BuildQuery ¶
func (*Lister) SetQueryLogger ¶
func (ll *Lister) SetQueryLogger(logger QueryLogger)
type NestedField ¶
type NestedField struct {
// The column containing the element JSONB
RootColumn string
// The path from the column root to the node
Path Path
// ValueColumn contains the value of the field directly in the table in
// addition to nested within the JSONB data.
ValueColumn *string
}
func (*NestedField) ProtoChild ¶
func (nf *NestedField) ProtoChild(name string) (*NestedField, error)
func (*NestedField) Selector ¶
func (nf *NestedField) Selector(inTable string) string
type Path ¶
type Path struct {
// contains filtered or unexported fields
}
func NewJSONPath ¶
func NewJSONPath(rootMessage *j5schema.ObjectSchema, fieldPath JSONPathSpec) (*Path, error)
func NewProtoPath ¶
func NewProtoPath(rootMessage *j5schema.ObjectSchema, fieldPath ProtoPathSpec) (*Path, error)
func (Path) ClientPath ¶
func (*Path) JSONBArrowPath ¶
func (*Path) JSONPathQuery ¶
func (Path) LeafField ¶
func (pp Path) LeafField() *j5schema.ObjectProperty
func (Path) LeafOneof ¶
func (pp Path) LeafOneof() *j5schema.OneofSchema
func (Path) Root ¶
func (pp Path) Root() *j5schema.ObjectSchema
func (Path) WalkPathNodes ¶
func (pp Path) WalkPathNodes(callback func(*j5schema.ObjectProperty) bool)
WalkPathNodes visits every field in the path other than the leaf field itself, calling the callback for each. Walking stops if the callback returns false.
type ProtoField ¶
type ProtoField struct {
// contains filtered or unexported fields
}
ProtoField represents a field within a the root data.
func NewJSONField ¶
func NewJSONField(protoPath string, columnName *string) ProtoField
type ProtoPathSpec ¶
type ProtoPathSpec []string
type Query ¶
type Query struct {
*sq.SelectBuilder
// contains filtered or unexported fields
}
func (*Query) AddRootColumn ¶
func (ll *Query) AddRootColumn()
type QueryLogger ¶
type TSVColumn ¶
func TSVColumns ¶
func TSVColumns(message *j5schema.ObjectSchema) ([]*TSVColumn, error)
type TableReflectionSet ¶
type TableReflectionSet struct {
// contains filtered or unexported fields
}
func NewTableReflectionSet ¶
func NewTableReflectionSet(table TableSpec) (*TableReflectionSet, error)
func (*TableReflectionSet) ArrayObject ¶
func (ll *TableReflectionSet) ArrayObject() *j5schema.ObjectSchema
func (*TableReflectionSet) BuildQuery ¶
func (ll *TableReflectionSet) BuildQuery(ctx context.Context, reqQuery *list_j5pb.QueryRequest) (*Query, error)
type TableSpec ¶
type TableSpec struct {
TableName string
Auth AuthProvider
AuthJoin []*LeftJoin
DataColumn string // TODO: Replace with array Columns []Column
RootObject *j5schema.ObjectSchema
// List of fields to sort by if no other unique sort is found.
FallbackSortColumns []ProtoField
}