Documentation
¶
Index ¶
- Variables
- func EachField(entity interface{}, ...)
- type AttemptDAO
- type AttemptDetailDAO
- type AttemptQuery
- type AttemptResult
- type BaseDAO
- type Condition
- type Cursor
- type DAO
- func (dao *DAO[T]) BatchInsert(ctx context.Context, entities []*T) error
- func (dao *DAO[T]) Count(ctx context.Context, query *Query) (total int64, err error)
- func (dao *DAO[T]) Cursor(ctx context.Context, query *Query) (cursor Cursor[*T], err error)
- func (dao *DAO[T]) DB(ctx context.Context) Queryable
- func (dao *DAO[T]) Delete(ctx context.Context, id string) (bool, error)
- func (dao *DAO[T]) Get(ctx context.Context, id string) (entity *T, err error)
- func (dao *DAO[T]) Insert(ctx context.Context, entity *T) error
- func (dao *DAO[T]) Iterate(ctx context.Context, query *Query) *Iterator[T]
- func (dao *DAO[T]) List(ctx context.Context, query *Query) (list []*T, err error)
- func (dao *DAO[T]) Select(ctx context.Context, field string, value string) (entity *T, err error)
- func (dao *DAO[T]) Update(ctx context.Context, entity *T) error
- func (dao *DAO[T]) Upsert(ctx context.Context, fields []string, entity *T) error
- type EndpointDAO
- type EndpointQuery
- type EventDAO
- type EventQuery
- type Iterator
- type Operator
- type OptionFunc
- type Options
- type Order
- type PluginDAO
- type PluginQuery
- type Query
- type Queryable
- type Schema
- type SchemaMeta
- type Sort
- type SourceDAO
- type SourceQuery
- type WorkspaceDAO
- type WorkspaceQuery
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNoRows = sql.ErrNoRows ErrConstraintViolation = errors.New("constraint violation") )
Functions ¶
Types ¶
type AttemptDAO ¶
type AttemptDAO interface {
BaseDAO[entities.Attempt]
UpdateStatusToQueued(ctx context.Context, ids []string) error
UpdateErrorCode(ctx context.Context, id string, status entities.AttemptStatus, code entities.AttemptErrorCode) error
UpdateDelivery(ctx context.Context, result *AttemptResult) error
ListUnqueuedForUpdate(ctx context.Context, maxScheduledAt time.Time, limit int) (list []*entities.Attempt, err error)
}
func NewAttemptDao ¶
func NewAttemptDao(db *sqlx.DB, fns ...OptionFunc) AttemptDAO
type AttemptDetailDAO ¶ added in v0.2.0
type AttemptDetailDAO interface {
BaseDAO[entities.AttemptDetail]
Insert(ctx context.Context, attemptDetail *entities.AttemptDetail) error
}
func NewAttemptDetailDao ¶ added in v0.2.0
func NewAttemptDetailDao(db *sqlx.DB, fns ...OptionFunc) AttemptDetailDAO
type AttemptQuery ¶ added in v1.1.0
func (*AttemptQuery) ToQuery ¶ added in v1.1.0
func (q *AttemptQuery) ToQuery() *Query
type AttemptResult ¶
type AttemptResult struct {
ID string
Request *entities.AttemptRequest
Response *entities.AttemptResponse
AttemptedAt types.Time
Status entities.AttemptStatus
ErrorCode *entities.AttemptErrorCode
Exhausted bool
}
type BaseDAO ¶
type BaseDAO[T any] interface { Get(ctx context.Context, id string) (*T, error) Select(ctx context.Context, field string, id string) (*T, error) Insert(ctx context.Context, entity *T) error Update(ctx context.Context, entity *T) error Upsert(ctx context.Context, fields []string, entity *T) error Delete(ctx context.Context, id string) (bool, error) Count(ctx context.Context, query *Query) (int64, error) List(ctx context.Context, query *Query) ([]*T, error) Cursor(ctx context.Context, query *Query) (Cursor[*T], error) BatchInsert(ctx context.Context, entities []*T) error Iterate(ctx context.Context, query *Query) *Iterator[T] }
type DAO ¶
type DAO[T Schema] struct { // contains filtered or unexported fields }
func (*DAO[T]) BatchInsert ¶
type EndpointDAO ¶
type EndpointDAO interface {
BaseDAO[entities.Endpoint]
Disable(ctx context.Context, id string) (bool, error)
}
func NewEndpointDAO ¶
func NewEndpointDAO(db *sqlx.DB, fns ...OptionFunc) EndpointDAO
type EndpointQuery ¶ added in v1.1.0
func (*EndpointQuery) ToQuery ¶ added in v1.1.0
func (q *EndpointQuery) ToQuery() *Query
type EventDAO ¶
type EventDAO interface {
BaseDAO[entities.Event]
BatchInsertIgnoreConflict(ctx context.Context, events []*entities.Event) ([]string, error)
ListExistingUniqueIDs(ctx context.Context, uniques []string) ([]string, error)
}
func NewEventDao ¶
func NewEventDao(db *sqlx.DB, fns ...OptionFunc) EventDAO
type EventQuery ¶ added in v1.1.0
type EventQuery struct {
Query
}
type Iterator ¶ added in v1.1.0
type Iterator[T any] struct { // contains filtered or unexported fields }
type OptionFunc ¶ added in v1.0.1
type OptionFunc func(*Options)
func WithInstrumented ¶ added in v1.0.1
func WithInstrumented() OptionFunc
func WithPropagateHandler ¶ added in v1.0.1
func WithPropagateHandler(fn func(ctx context.Context, opts *Options, id string, entity interface{})) OptionFunc
func WithWorkspace ¶ added in v1.0.1
func WithWorkspace(workspace bool) OptionFunc
type PluginDAO ¶ added in v0.2.0
func NewPluginDAO ¶ added in v0.2.0
func NewPluginDAO(db *sqlx.DB, fns ...OptionFunc) PluginDAO
type PluginQuery ¶ added in v1.1.0
type PluginQuery struct {
Query
WorkspaceId *string
EndpointId *string
SourceId *string
Enabled *bool
}
func (*PluginQuery) ToQuery ¶ added in v1.1.0
func (q *PluginQuery) ToQuery() *Query
type Query ¶ added in v1.1.0
type Queryable ¶
type Queryable interface {
sqlx.ExtContext
GetContext(context.Context, interface{}, string, ...interface{}) error
SelectContext(context.Context, interface{}, string, ...interface{}) error
}
Queryable is an interface to be used interchangeably for sqlx.Db and sqlx.Tx
type SchemaMeta ¶ added in v1.1.0
type SchemaMeta struct {
Name string
// contains filtered or unexported fields
}
func NewSchema ¶ added in v1.1.0
func NewSchema[T any](name string) *SchemaMeta
func (*SchemaMeta) Columns ¶ added in v1.1.0
func (s *SchemaMeta) Columns() []string
func (*SchemaMeta) HasColumn ¶ added in v1.1.0
func (s *SchemaMeta) HasColumn(column string) bool
func (*SchemaMeta) InsertColumns ¶ added in v1.1.0
func (s *SchemaMeta) InsertColumns() []string
type SourceDAO ¶
func NewSourceDAO ¶
func NewSourceDAO(db *sqlx.DB, fns ...OptionFunc) SourceDAO
type SourceQuery ¶ added in v1.1.0
func (*SourceQuery) ToQuery ¶ added in v1.1.0
func (q *SourceQuery) ToQuery() *Query
type WorkspaceDAO ¶
type WorkspaceDAO interface {
BaseDAO[entities.Workspace]
GetDefault(ctx context.Context) (*entities.Workspace, error)
GetWorkspace(ctx context.Context, name string) (*entities.Workspace, error)
}
func NewWorkspaceDAO ¶
func NewWorkspaceDAO(db *sqlx.DB, fns ...OptionFunc) WorkspaceDAO
type WorkspaceQuery ¶ added in v1.1.0
type WorkspaceQuery struct {
Query
}
Click to show internal directories.
Click to hide internal directories.