Documentation
¶
Index ¶
- type AuthProvider
- type AuthProviderFunc
- type Column
- type GetJoinSpec
- type GetRequest
- type GetResponse
- type GetSpec
- type Getter
- type JoinField
- type JoinFields
- type LeftJoin
- type ListReflectionSet
- type ListRequest
- type ListResponse
- type ListSpec
- type Lister
- func (ll *Lister[REQ, RES]) BuildQuery(ctx context.Context, req protoreflect.Message, res protoreflect.Message) (*sq.SelectBuilder, error)
- func (ll *Lister[REQ, RES]) List(ctx context.Context, db Transactor, reqMsg proto.Message, resMsg proto.Message) error
- func (ll *Lister[REQ, RES]) SetQueryLogger(logger QueryLogger)
- type ProtoField
- type QueryLogger
- type TableSpec
- type Transactor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthProvider ¶
type AuthProviderFunc ¶
func (AuthProviderFunc) AuthFilter ¶
type GetJoinSpec ¶
type GetJoinSpec struct {
TableName string
DataColumn string
On JoinFields
FieldInParent protoreflect.Name
}
type GetRequest ¶
type GetResponse ¶
type GetSpec ¶
type GetSpec[ REQ GetRequest, RES GetResponse, ] struct { TableName string DataColumn string Auth AuthProvider AuthJoin []*LeftJoin PrimaryKey func(REQ) (map[string]any, error) StateResponseField protoreflect.Name Join *GetJoinSpec }
type Getter ¶
type Getter[ REQ GetRequest, RES proto.Message, ] struct { // contains filtered or unexported fields }
func NewGetter ¶
func NewGetter[ REQ GetRequest, RES GetResponse, ](spec GetSpec[REQ, RES]) (*Getter[REQ, RES], error)
func (*Getter[REQ, RES]) Get ¶
func (gc *Getter[REQ, RES]) Get(ctx context.Context, db Transactor, reqMsg REQ, resMsg RES) error
func (*Getter[REQ, RES]) SetQueryLogger ¶
func (gc *Getter[REQ, RES]) SetQueryLogger(logger QueryLogger)
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 {
RequestFilterFields []protoreflect.FieldDescriptor
// contains filtered or unexported fields
}
func BuildListReflection ¶
func BuildListReflection(req protoreflect.MessageDescriptor, res protoreflect.MessageDescriptor, table TableSpec) (*ListReflectionSet, error)
type ListRequest ¶
type ListResponse ¶
type ListSpec ¶
type ListSpec[REQ ListRequest, RES ListResponse] struct { TableSpec RequestFilter func(REQ) (map[string]any, error) }
type Lister ¶
type Lister[REQ ListRequest, RES ListResponse] struct { ListReflectionSet // contains filtered or unexported fields }
func NewLister ¶
func NewLister[ REQ ListRequest, RES ListResponse, ](spec ListSpec[REQ, RES]) (*Lister[REQ, RES], error)
func (*Lister[REQ, RES]) BuildQuery ¶
func (ll *Lister[REQ, RES]) BuildQuery(ctx context.Context, req protoreflect.Message, res protoreflect.Message) (*sq.SelectBuilder, error)
func (*Lister[REQ, RES]) SetQueryLogger ¶
func (ll *Lister[REQ, RES]) SetQueryLogger(logger QueryLogger)
type ProtoField ¶
type ProtoField struct {
// contains filtered or unexported fields
}
ProtoField represents a field within a the root data.
func NewProtoField ¶
func NewProtoField(protoPath string, columnName *string) ProtoField
type QueryLogger ¶
type TableSpec ¶
type TableSpec struct {
TableName string
Auth AuthProvider
AuthJoin []*LeftJoin
DataColumn string // TODO: Replace with array Columns []Column
// List of fields to sort by if no other unique sort is found.
FallbackSortColumns []ProtoField
}
Click to show internal directories.
Click to hide internal directories.