qdata

package
v0.1.152 Latest Latest
Warning

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

Go to latest
Published: May 26, 2025 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const IndirectionDelimiter = "->"

Variables

Functions

func AccumulateErrors added in v0.1.83

func AccumulateErrors(errs ...error) error

func CastEntityIdSliceToStringSlice added in v0.1.47

func CastEntityIdSliceToStringSlice(i []EntityId) []string

func CastSlice added in v0.1.47

func CastSlice[I any, O any](i []I, convert func(I) O) []O

func CastToInterfaceSlice added in v0.1.47

func CastToInterfaceSlice[T any](i []T) []any

func CopySlice added in v0.1.47

func CopySlice[I any](i []I) []I

func FileDecode

func FileDecode(encoded string) []byte

func FileEncode

func FileEncode(content []byte) string

Types

type AnyPbConverter added in v0.1.47

type AnyPbConverter interface {
	AsAnyPb() *anypb.Any
}

type BinaryFileProvider added in v0.1.47

type BinaryFileProvider interface {
	GetBinaryFile() string
}

type BinaryFileReceiver added in v0.1.47

type BinaryFileReceiver interface {
	SetBinaryFile(value string)
}

type BoolProvider added in v0.1.47

type BoolProvider interface {
	GetBool() bool
}

type BoolReceiver added in v0.1.47

type BoolReceiver interface {
	SetBool(value bool)
}

type ChoiceProvider added in v0.1.47

type ChoiceProvider interface {
	GetChoice() int
}

type ChoiceReceiver added in v0.1.47

type ChoiceReceiver interface {
	SetChoice(value int)
}

type ConnectedArgs added in v0.1.47

type ConnectedArgs struct {
	Ctx context.Context
}

type DisconnectedArgs added in v0.1.47

type DisconnectedArgs struct {
	Ctx context.Context
	Err error
}

type Entity

type Entity struct {
	EntityId   EntityId
	EntityType EntityType

	Fields map[FieldType]*Field
}

func (*Entity) ApplyOpts added in v0.1.47

func (me *Entity) ApplyOpts(opts ...EntityOpts) *Entity

func (*Entity) AsEntityPb added in v0.1.47

func (me *Entity) AsEntityPb() *qprotobufs.DatabaseEntity

func (*Entity) Clone added in v0.1.47

func (me *Entity) Clone() *Entity

func (*Entity) Field added in v0.1.47

func (me *Entity) Field(fieldType FieldType, opts ...FieldOpts) *Field

func (*Entity) FromEntityPb added in v0.1.47

func (me *Entity) FromEntityPb(pb *qprotobufs.DatabaseEntity) *Entity

func (*Entity) Init added in v0.1.47

func (me *Entity) Init(entityId EntityId, opts ...EntityOpts) *Entity

type EntityFieldValidator

type EntityFieldValidator interface {
	// RegisterEntityFields registers required fields for an entity type
	RegisterEntityFields(entityType EntityType, fields ...FieldType)
	// ValidateFields checks if all registered entity fields exist in the schema
	ValidateFields(context.Context) error
}

EntityFieldValidator ensures that entities and their fields exist in the schema

func NewEntityFieldValidator

func NewEntityFieldValidator(store *Store) EntityFieldValidator

type EntityId added in v0.1.47

type EntityId string

func CastStringSliceToEntityIdSlice added in v0.1.47

func CastStringSliceToEntityIdSlice(i []string) []EntityId

func GenerateEntityId added in v0.1.83

func GenerateEntityId(entityType EntityType) EntityId

func (*EntityId) AsEntityReferencePb added in v0.1.47

func (me *EntityId) AsEntityReferencePb() *qprotobufs.EntityReference

func (EntityId) AsInt added in v0.1.121

func (me EntityId) AsInt() int64

func (EntityId) AsString added in v0.1.47

func (me EntityId) AsString() string

func (*EntityId) AsStringPb added in v0.1.47

func (me *EntityId) AsStringPb() *qprotobufs.String

func (*EntityId) FromString added in v0.1.47

func (me *EntityId) FromString(s string) *EntityId

func (EntityId) GetEntityType added in v0.1.47

func (me EntityId) GetEntityType() EntityType

func (*EntityId) IsEmpty added in v0.1.47

func (me *EntityId) IsEmpty() bool

type EntityIdSlice added in v0.1.83

type EntityIdSlice []EntityId

func (EntityIdSlice) AsStringSlice added in v0.1.83

func (me EntityIdSlice) AsStringSlice() []string

func (EntityIdSlice) FromStringSlice added in v0.1.83

func (me EntityIdSlice) FromStringSlice(i []string) EntityIdSlice

type EntityListProvider added in v0.1.47

type EntityListProvider interface {
	GetEntityList() []EntityId
}

type EntityListReceiver added in v0.1.47

type EntityListReceiver interface {
	SetEntityList(value []EntityId)
}

type EntityOpts added in v0.1.47

type EntityOpts func(*Entity)

func EOEntityId added in v0.1.47

func EOEntityId(eid EntityId) EntityOpts

func EOEntityType added in v0.1.47

func EOEntityType(et EntityType) EntityOpts

func EOField added in v0.1.47

func EOField(fieldType FieldType, opts ...FieldOpts) EntityOpts

func EOFields added in v0.1.47

func EOFields(fields map[FieldType]*Field) EntityOpts

type EntityReferenceProvider added in v0.1.47

type EntityReferenceProvider interface {
	GetEntityReference() EntityId
}

type EntityReferenceReceiver added in v0.1.47

type EntityReferenceReceiver interface {
	SetEntityReference(value EntityId)
}

type EntitySchema

type EntitySchema struct {
	EntityType EntityType
	Fields     map[FieldType]*FieldSchema
}

func (*EntitySchema) ApplyOpts added in v0.1.47

func (me *EntitySchema) ApplyOpts(opts ...EntitySchemaOpts) *EntitySchema

func (*EntitySchema) AsBytes added in v0.1.83

func (me *EntitySchema) AsBytes() ([]byte, error)

func (*EntitySchema) AsEntitySchemaPb added in v0.1.47

func (me *EntitySchema) AsEntitySchemaPb() *qprotobufs.DatabaseEntitySchema

func (*EntitySchema) Clone added in v0.1.47

func (me *EntitySchema) Clone() *EntitySchema

func (*EntitySchema) Field added in v0.1.47

func (me *EntitySchema) Field(fieldType FieldType, opts ...FieldSchemaOpts) *FieldSchema

func (*EntitySchema) FromBytes added in v0.1.83

func (me *EntitySchema) FromBytes(data []byte) (*EntitySchema, error)

func (*EntitySchema) FromEntitySchemaPb added in v0.1.47

func (me *EntitySchema) FromEntitySchemaPb(pb *qprotobufs.DatabaseEntitySchema) *EntitySchema

func (*EntitySchema) Init added in v0.1.47

func (me *EntitySchema) Init(entityType EntityType, opts ...EntitySchemaOpts) *EntitySchema

type EntitySchemaOpts added in v0.1.47

type EntitySchemaOpts func(*EntitySchema)

func ESOEntityType added in v0.1.47

func ESOEntityType(et EntityType) EntitySchemaOpts

func ESOField added in v0.1.47

func ESOField(fieldType FieldType, opts ...FieldSchemaOpts) EntitySchemaOpts

func ESOFields added in v0.1.47

func ESOFields(fields map[FieldType]*FieldSchema) EntitySchemaOpts

type EntityType added in v0.1.47

type EntityType string
const (
	ETRoot                 EntityType = "Root"
	ETFolder               EntityType = "Folder"
	ETRole                 EntityType = "Role"
	ETUser                 EntityType = "User"
	ETClient               EntityType = "Client"
	ETPermission           EntityType = "Permission"
	ETAreaOfResponsibility EntityType = "AreaOfResponsibility"
	ETSessionController    EntityType = "SessionController"
)

func (EntityType) AsInt added in v0.1.121

func (me EntityType) AsInt() int64

func (EntityType) AsString added in v0.1.47

func (me EntityType) AsString() string

func (*EntityType) FromString added in v0.1.47

func (me *EntityType) FromString(s string) *EntityType

type EntityTypeSlice added in v0.1.83

type EntityTypeSlice []EntityType

func (EntityTypeSlice) AsStringSlice added in v0.1.83

func (me EntityTypeSlice) AsStringSlice() []string

func (EntityTypeSlice) FromStringSlice added in v0.1.83

func (me EntityTypeSlice) FromStringSlice(i []string) EntityTypeSlice

type Field

type Field struct {
	EntityId  EntityId
	FieldType FieldType
	Value     *Value
	WriteTime WriteTime
	WriterId  EntityId
}

func (*Field) ApplyOpts added in v0.1.47

func (me *Field) ApplyOpts(opts ...FieldOpts) *Field

func (*Field) AsBytes added in v0.1.83

func (me *Field) AsBytes() ([]byte, error)

func (*Field) AsFieldPb added in v0.1.47

func (me *Field) AsFieldPb() *qprotobufs.DatabaseField

func (*Field) AsReadRequest added in v0.1.47

func (me *Field) AsReadRequest(opts ...RequestOpts) *Request

func (*Field) AsWriteRequest added in v0.1.47

func (me *Field) AsWriteRequest(opts ...RequestOpts) *Request

func (*Field) Clone added in v0.1.47

func (me *Field) Clone() *Field

func (*Field) FromBytes added in v0.1.83

func (me *Field) FromBytes(data []byte) (*Field, error)

func (*Field) FromFieldPb added in v0.1.47

func (me *Field) FromFieldPb(pb *qprotobufs.DatabaseField) *Field

func (*Field) Init added in v0.1.47

func (me *Field) Init(entityId EntityId, fieldType FieldType, opts ...FieldOpts) *Field

type FieldOpts added in v0.1.47

type FieldOpts func(*Field)

func FOEntityId added in v0.1.47

func FOEntityId(id EntityId) FieldOpts

func FOFieldType added in v0.1.47

func FOFieldType(ft FieldType) FieldOpts

func FOValue added in v0.1.47

func FOValue(v *Value) FieldOpts

func FOWriteTime added in v0.1.47

func FOWriteTime[T time.Time | WriteTime](t T) FieldOpts

func FOWriterId added in v0.1.47

func FOWriterId(id EntityId) FieldOpts

type FieldSchema

type FieldSchema struct {
	EntityType EntityType
	FieldType  FieldType
	ValueType  ValueType
	Rank       int

	ReadPermissions  EntityIdSlice
	WritePermissions EntityIdSlice

	Choices []string
}

func (*FieldSchema) ApplyOpts added in v0.1.47

func (me *FieldSchema) ApplyOpts(opts ...FieldSchemaOpts) *FieldSchema

func (*FieldSchema) AsFieldSchemaPb added in v0.1.47

func (me *FieldSchema) AsFieldSchemaPb() *qprotobufs.DatabaseFieldSchema

func (*FieldSchema) Clone added in v0.1.47

func (me *FieldSchema) Clone() *FieldSchema

func (*FieldSchema) FromFieldSchemaPb added in v0.1.47

func (me *FieldSchema) FromFieldSchemaPb(entityType EntityType, pb *qprotobufs.DatabaseFieldSchema) *FieldSchema

func (*FieldSchema) Init added in v0.1.47

func (me *FieldSchema) Init(entityType EntityType, fieldType FieldType, valueType ValueType, opts ...FieldSchemaOpts) *FieldSchema

type FieldSchemaOpts added in v0.1.47

type FieldSchemaOpts func(*FieldSchema)

func FSOChoices added in v0.1.47

func FSOChoices(choices ...string) FieldSchemaOpts

func FSOEntityType added in v0.1.47

func FSOEntityType(et EntityType) FieldSchemaOpts

func FSOFieldType added in v0.1.47

func FSOFieldType(ft FieldType) FieldSchemaOpts

func FSORank added in v0.1.51

func FSORank(rank int) FieldSchemaOpts

func FSOReadPermissions added in v0.1.47

func FSOReadPermissions(permissions []EntityId) FieldSchemaOpts

func FSOValueType added in v0.1.47

func FSOValueType(vt ValueType) FieldSchemaOpts

func FSOWritePermissions added in v0.1.47

func FSOWritePermissions(permissions []EntityId) FieldSchemaOpts

type FieldType added in v0.1.47

type FieldType string
const (
	FTAreasOfResponsibilities FieldType = "AreasOfResponsibilities"
	FTChildren                FieldType = "Children"
	FTDescription             FieldType = "Description"
	FTEmail                   FieldType = "Email"
	FTEntityCreated           FieldType = "EntityCreated"
	FTEntityDeleted           FieldType = "EntityDeleted"
	FTFirstName               FieldType = "FirstName"
	FTIdleMsPerSecond         FieldType = "IdleMsPerSecond"
	FTIsEmailVerified         FieldType = "IsEmailVerified"
	FTIsEnabled               FieldType = "IsEnabled"
	FTJSON                    FieldType = "JSON"
	FTKeycloakId              FieldType = "KeycloakId"
	FTLastEventTime           FieldType = "LastEventTime"
	FTLastName                FieldType = "LastName"
	FTLogLevel                FieldType = "LogLevel"
	FTLogout                  FieldType = "Logout"
	FTName                    FieldType = "Name"
	FTParent                  FieldType = "Parent"
	FTPolicy                  FieldType = "Policy"
	FTQLibLogLevel            FieldType = "QLibLogLevel"
	FTReadsPerSecond          FieldType = "ReadsPerSecond"
	FTRoles                   FieldType = "Roles"
	FTSchemaChanged           FieldType = "SchemaChanged"
	FTSourceOfTruth           FieldType = "SourceOfTruth"
	FTWritesPerSecond         FieldType = "WritesPerSecond"
)

func (FieldType) AsIndirectionArray added in v0.1.47

func (me FieldType) AsIndirectionArray() []FieldType

func (FieldType) AsListIndex added in v0.1.47

func (me FieldType) AsListIndex() int

func (FieldType) AsString added in v0.1.47

func (me FieldType) AsString() string

func (*FieldType) FromString added in v0.1.47

func (me *FieldType) FromString(s string) *FieldType

func (FieldType) IsIndirection added in v0.1.47

func (me FieldType) IsIndirection() bool

func (FieldType) IsListIndex added in v0.1.47

func (me FieldType) IsListIndex() bool

type FieldTypeSlice added in v0.1.83

type FieldTypeSlice []FieldType

func (FieldTypeSlice) AsStringSlice added in v0.1.83

func (me FieldTypeSlice) AsStringSlice() []string

func (FieldTypeSlice) FromStringSlice added in v0.1.83

func (me FieldTypeSlice) FromStringSlice(i []string) FieldTypeSlice

type FloatProvider added in v0.1.47

type FloatProvider interface {
	GetFloat() float64
}

type FloatReceiver added in v0.1.47

type FloatReceiver interface {
	SetFloat(value float64)
}

type IndirectionResolver

type IndirectionResolver interface {
	Resolve(context.Context, EntityId, FieldType) (EntityId, FieldType, error)
}

func NewIndirectionResolver added in v0.1.47

func NewIndirectionResolver(store StoreInteractor) IndirectionResolver

type IntProvider added in v0.1.47

type IntProvider interface {
	GetInt() int
}

type IntReceiver added in v0.1.47

type IntReceiver interface {
	SetInt(value int)
}

type Notification

type Notification interface {
	GetToken() string
	GetCurrent() *Field
	GetPrevious() *Field
	GetContext(index int) *Field
	GetContextCount() int
}

type NotificationCallback

type NotificationCallback interface {
	Fn(context.Context, Notification)
	Id() string
}

type NotificationConfig

type NotificationConfig interface {
	GetEntityId() EntityId
	GetEntityType() EntityType
	GetFieldType() FieldType
	GetContextFields() []FieldType
	GetNotifyOnChange() bool
	GetServiceId() string
	GetToken() string
	IsDistributed() bool

	SetEntityId(EntityId) NotificationConfig
	SetEntityType(EntityType) NotificationConfig
	SetFieldType(FieldType) NotificationConfig
	SetContextFields(...FieldType) NotificationConfig
	SetNotifyOnChange(bool) NotificationConfig
	SetServiceId(string) NotificationConfig
	SetDistributed(bool) NotificationConfig
}

type NotificationToken

type NotificationToken interface {
	Id() string
	Unbind(context.Context)
}

type PageConfig added in v0.1.47

type PageConfig struct {
	PageSize int64
	CursorId int64
}

func DefaultPageConfig added in v0.1.47

func DefaultPageConfig() *PageConfig

func (*PageConfig) ApplyOpts added in v0.1.47

func (me *PageConfig) ApplyOpts(opts ...PageOpts) *PageConfig

func (*PageConfig) IntoOpts added in v0.1.47

func (me *PageConfig) IntoOpts() []PageOpts

type PageOpts added in v0.1.47

type PageOpts func(*PageConfig)

func POCursorId added in v0.1.47

func POCursorId(cursorId int64) PageOpts

func POPageSize added in v0.1.47

func POPageSize(pageSize int64) PageOpts

type PageResult added in v0.1.47

type PageResult[T any] struct {
	Items    []T
	CursorId int64 // Tracks the cursor ID for the next page. Negative means no more results.
	NextPage func(ctx context.Context) (*PageResult[T], error)
	Cleanup  func() error // Optional cleanup function to be called when the page is done
}

func (*PageResult[T]) Close added in v0.1.54

func (p *PageResult[T]) Close() error

func (*PageResult[T]) ForEach added in v0.1.48

func (p *PageResult[T]) ForEach(ctx context.Context, fn func(item T) bool)

func (*PageResult[T]) Get added in v0.1.47

func (p *PageResult[T]) Get() T

func (*PageResult[T]) Next added in v0.1.47

func (p *PageResult[T]) Next(ctx context.Context) bool

type ParsedQuery added in v0.1.47

type ParsedQuery struct {
	Columns     map[string]QueryColumn // Changed from slice to map keyed by FinalName
	ColumnOrder []string
	Tables      map[string]QueryTable // Changed from slice to map keyed by FinalName
	OriginalSQL string
	From        sqlparser.TableExprs
	Where       *sqlparser.Where
	OrderBy     sqlparser.OrderBy
	GroupBy     sqlparser.GroupBy
	Having      *sqlparser.Where
}

func ParseQuery added in v0.1.47

func ParseQuery(ctx context.Context, sql string, store StoreInteractor) (*ParsedQuery, error)

type PathResolver added in v0.1.48

type PathResolver interface {
	Resolve(context.Context, ...string) (*Entity, error)
}

func NewPathResolver added in v0.1.48

func NewPathResolver(store StoreInteractor) PathResolver

type PublishNotificationArgs added in v0.1.47

type PublishNotificationArgs struct {
	Ctx  context.Context
	Curr *Request
	Prev *Request
}

type QueryColumn added in v0.1.67

type QueryColumn struct {
	ColumnName   string
	Alias        string
	Table        QueryTable
	SelectedName string
	IsSelected   bool
	Order        int // Add this field to track selection order
}

func (*QueryColumn) FieldType added in v0.1.67

func (me *QueryColumn) FieldType() FieldType

func (*QueryColumn) FinalName added in v0.1.67

func (me *QueryColumn) FinalName() string

func (*QueryColumn) QualifiedName added in v0.1.79

func (me *QueryColumn) QualifiedName() string

func (*QueryColumn) QualifiedNameWithQuotes added in v0.1.80

func (me *QueryColumn) QualifiedNameWithQuotes() string

type QueryEngineType added in v0.1.105

type QueryEngineType string
const (
	QESqlite QueryEngineType = "sqlite"
)

type QueryRow added in v0.1.67

type QueryRow interface {
	Get(column string) *Value
	Set(column string, value *Value, selected bool)
	Columns() []string
	Selected() []string
	SetOrder([]string)
	IsSelected(column string) bool
	AsQueryRowPb() *qprotobufs.QueryRow
	FromQueryRowPb(row *qprotobufs.QueryRow)
	AsEntity() *Entity
}

func NewQueryRow added in v0.1.67

func NewQueryRow() QueryRow

type QueryTable added in v0.1.47

type QueryTable struct {
	TableName string
	Alias     string
}

func (*QueryTable) EntityType added in v0.1.47

func (me *QueryTable) EntityType() EntityType

func (*QueryTable) FinalName added in v0.1.67

func (me *QueryTable) FinalName() string

type RawProvider added in v0.1.47

type RawProvider interface {
	GetRaw() any
}

type RawReceiver added in v0.1.47

type RawReceiver interface {
	SetRaw(value any)
}

type ReadEventArgs added in v0.1.95

type ReadEventArgs struct {
	Ctx context.Context
	Req *Request
}

type Request

type Request struct {
	EntityId  EntityId
	FieldType FieldType
	Value     *Value
	WriteOpt  WriteOpt   // optional
	WriteTime *WriteTime // optional
	WriterId  *EntityId  // optional
	Success   bool
	Err       error
}

func (*Request) ApplyOpts added in v0.1.47

func (me *Request) ApplyOpts(opts ...RequestOpts) *Request

func (*Request) AsField added in v0.1.47

func (me *Request) AsField() *Field

func (*Request) AsRequestPb added in v0.1.47

func (me *Request) AsRequestPb() *qprotobufs.DatabaseRequest

func (*Request) Clone

func (me *Request) Clone() *Request

func (*Request) FromRequestPb added in v0.1.48

func (me *Request) FromRequestPb(pb *qprotobufs.DatabaseRequest) *Request

func (*Request) Init added in v0.1.47

func (me *Request) Init(entityId EntityId, fieldType FieldType, opts ...RequestOpts) *Request

type RequestOpts added in v0.1.47

type RequestOpts func(*Request)

func ROEntityId added in v0.1.47

func ROEntityId(id EntityId) RequestOpts

func ROFieldType added in v0.1.47

func ROFieldType(ft FieldType) RequestOpts

func ROValue added in v0.1.47

func ROValue(v *Value) RequestOpts

func ROValuePtr added in v0.1.58

func ROValuePtr(v *Value) RequestOpts

func ROWriteChanges added in v0.1.47

func ROWriteChanges() RequestOpts

func ROWriteNormal added in v0.1.47

func ROWriteNormal() RequestOpts

func ROWriteTime added in v0.1.47

func ROWriteTime[T time.Time | WriteTime](t T) RequestOpts

func ROWriteTimePtr added in v0.1.47

func ROWriteTimePtr(t *WriteTime) RequestOpts

func ROWriterId added in v0.1.47

func ROWriterId(id EntityId) RequestOpts

func ROWriterIdPtr added in v0.1.47

func ROWriterIdPtr(id *EntityId) RequestOpts

type SQLiteBuilder added in v0.1.47

type SQLiteBuilder struct {
	// contains filtered or unexported fields
}

func NewSQLiteBuilder added in v0.1.47

func NewSQLiteBuilder(store StoreInteractor) (*SQLiteBuilder, error)

func (*SQLiteBuilder) Close added in v0.1.54

func (me *SQLiteBuilder) Close() error

Close releases resources used by the SQLiteBuilder

func (*SQLiteBuilder) QueryWithPagination added in v0.1.47

func (me *SQLiteBuilder) QueryWithPagination(ctx context.Context, query *ParsedQuery, pageSize int64, cursorId int64, opts ...TypeHintOpts) (*PageResult[QueryRow], error)

type Snapshot

type Snapshot struct {
	Entities []*Entity
	Fields   []*Field
	Schemas  []*EntitySchema
}

func (*Snapshot) ApplyOpts added in v0.1.47

func (me *Snapshot) ApplyOpts(opts ...SnapshotOpts) *Snapshot

func (*Snapshot) AsBytes added in v0.1.141

func (me *Snapshot) AsBytes() ([]byte, error)

func (*Snapshot) AsSnapshotPb added in v0.1.47

func (me *Snapshot) AsSnapshotPb() *qprotobufs.DatabaseSnapshot

func (*Snapshot) FromBytes added in v0.1.141

func (me *Snapshot) FromBytes(data []byte) (*Snapshot, error)

func (*Snapshot) FromSnapshotPb added in v0.1.47

func (me *Snapshot) FromSnapshotPb(pb *qprotobufs.DatabaseSnapshot) *Snapshot

func (*Snapshot) Init added in v0.1.47

func (me *Snapshot) Init(opts ...SnapshotOpts) *Snapshot

type SnapshotOpts added in v0.1.47

type SnapshotOpts func(*Snapshot)

func SOEntities added in v0.1.47

func SOEntities(entities ...*Entity) SnapshotOpts

func SOFields added in v0.1.47

func SOFields(fields ...*Field) SnapshotOpts

func SOSchemas added in v0.1.47

func SOSchemas(schemas ...*EntitySchema) SnapshotOpts

type Store

func (*Store) ApplyOpts added in v0.1.47

func (me *Store) ApplyOpts(opts ...StoreOpts) *Store

func (*Store) Init added in v0.1.47

func (me *Store) Init(opts ...StoreOpts) *Store

type StoreConnector added in v0.1.47

type StoreConnector interface {
	Connect(context.Context)
	Disconnect(context.Context)
	IsConnected() bool

	Connected() qss.Signal[ConnectedArgs]
	Disconnected() qss.Signal[DisconnectedArgs]
}

type StoreInteractor added in v0.1.47

type StoreInteractor interface {
	CreateEntity(ctx context.Context, eType EntityType, parentId EntityId, name string) (*Entity, error)
	DeleteEntity(context.Context, EntityId) error

	PrepareQuery(sql string, args ...any) (*PageResult[QueryRow], error)
	Find(ctx context.Context, entityType EntityType, fieldTypes []FieldType, conditionFns ...interface{}) ([]*Entity, error)
	FindEntities(entityType EntityType, pageOpts ...PageOpts) (*PageResult[EntityId], error)
	GetEntityTypes(pageOpts ...PageOpts) (*PageResult[EntityType], error)

	EntityExists(context.Context, EntityId) (bool, error)
	FieldExists(context.Context, EntityType, FieldType) (bool, error)

	GetEntitySchema(context.Context, EntityType) (*EntitySchema, error)
	SetEntitySchema(context.Context, *EntitySchema) error
	GetFieldSchema(context.Context, EntityType, FieldType) (*FieldSchema, error)
	SetFieldSchema(context.Context, EntityType, FieldType, *FieldSchema) error

	Read(context.Context, ...*Request) error
	Write(context.Context, ...*Request) error

	InitializeSchema(ctx context.Context) error
	CreateSnapshot(ctx context.Context) (*Snapshot, error)
	RestoreSnapshot(ctx context.Context, ss *Snapshot) error

	PublishNotifications() qss.Signal[PublishNotificationArgs]

	WriteEvent() qss.Signal[WriteEventArgs]
	ReadEvent() qss.Signal[ReadEventArgs]

	InteractorConnected() qss.Signal[ConnectedArgs]
	InteractorDisconnected() qss.Signal[DisconnectedArgs]
}

type StoreNotifier added in v0.1.47

type StoreNotifier interface {
	Notify(ctx context.Context, config NotificationConfig, callback NotificationCallback) (NotificationToken, error)
	Unnotify(ctx context.Context, subscriptionId string) error
	UnnotifyCallback(ctx context.Context, subscriptionId string, callback NotificationCallback) error

	NotifierConnected() qss.Signal[ConnectedArgs]
	NotifierDisconnected() qss.Signal[DisconnectedArgs]
}

type StoreOpts added in v0.1.47

type StoreOpts func(*Store)

type StringConverter added in v0.1.47

type StringConverter interface {
	AsString() string
}

type StringProvider added in v0.1.47

type StringProvider interface {
	GetString() string
}

type StringReceiver added in v0.1.47

type StringReceiver interface {
	SetString(value string)
}

type TimestampProvider added in v0.1.47

type TimestampProvider interface {
	GetTimestamp() time.Time
}

type TimestampReceiver added in v0.1.47

type TimestampReceiver interface {
	SetTimestamp(value time.Time)
}

type TypeHintMap added in v0.1.47

type TypeHintMap map[string]ValueType

func (TypeHintMap) ApplyOpts added in v0.1.47

func (me TypeHintMap) ApplyOpts(opts ...TypeHintOpts) TypeHintMap

type TypeHintOpts added in v0.1.47

type TypeHintOpts func(TypeHintMap)

func TypeHint added in v0.1.47

func TypeHint(columnName string, vt ValueType) TypeHintOpts

type Value

func NewBinaryFile added in v0.1.47

func NewBinaryFile(v ...string) *Value

func NewBool added in v0.1.47

func NewBool(v ...bool) *Value

func NewChoice added in v0.1.47

func NewChoice(v ...int) *Value

func NewEntityList added in v0.1.47

func NewEntityList(v ...[]EntityId) *Value

func NewEntityReference added in v0.1.47

func NewEntityReference(v ...EntityId) *Value

func NewFloat added in v0.1.47

func NewFloat(v ...float64) *Value

func NewInt added in v0.1.47

func NewInt(v ...int) *Value

func NewString added in v0.1.47

func NewString(v ...string) *Value

func NewTimestamp added in v0.1.47

func NewTimestamp(v ...time.Time) *Value

func (*Value) Equals added in v0.1.47

func (me *Value) Equals(o *Value) bool

func (*Value) FromAnyPb added in v0.1.47

func (me *Value) FromAnyPb(a *anypb.Any) *Value

func (*Value) FromBinaryFile added in v0.1.47

func (me *Value) FromBinaryFile(v string) *Value

func (*Value) FromBool added in v0.1.47

func (me *Value) FromBool(v bool) *Value

func (*Value) FromChoice added in v0.1.47

func (me *Value) FromChoice(v int) *Value

func (*Value) FromEntityList added in v0.1.47

func (me *Value) FromEntityList(v []EntityId) *Value

func (*Value) FromEntityReference added in v0.1.47

func (me *Value) FromEntityReference(v EntityId) *Value

func (*Value) FromFloat added in v0.1.47

func (me *Value) FromFloat(v float64) *Value

func (*Value) FromInt added in v0.1.47

func (me *Value) FromInt(v int) *Value

func (*Value) FromString added in v0.1.47

func (me *Value) FromString(v string) *Value

func (*Value) FromTimestamp added in v0.1.47

func (me *Value) FromTimestamp(v time.Time) *Value

func (*Value) FromValue added in v0.1.47

func (me *Value) FromValue(o *Value)

func (*Value) Init added in v0.1.47

func (me *Value) Init() *Value

type ValueBinaryFile added in v0.1.47

type ValueBinaryFile struct {
	Value []byte
}

func (*ValueBinaryFile) AsAnyPb added in v0.1.47

func (me *ValueBinaryFile) AsAnyPb() *anypb.Any

func (*ValueBinaryFile) AsString added in v0.1.47

func (me *ValueBinaryFile) AsString() string

func (*ValueBinaryFile) Clone added in v0.1.47

func (me *ValueBinaryFile) Clone() *Value

func (*ValueBinaryFile) GetBinaryFile added in v0.1.47

func (me *ValueBinaryFile) GetBinaryFile() string

func (*ValueBinaryFile) GetRaw added in v0.1.47

func (me *ValueBinaryFile) GetRaw() any

func (*ValueBinaryFile) SetBinaryFile added in v0.1.47

func (me *ValueBinaryFile) SetBinaryFile(value string)

func (*ValueBinaryFile) SetRaw added in v0.1.47

func (me *ValueBinaryFile) SetRaw(value any)

type ValueBool added in v0.1.47

type ValueBool struct {
	Value bool
}

func (*ValueBool) AsAnyPb added in v0.1.47

func (me *ValueBool) AsAnyPb() *anypb.Any

func (*ValueBool) AsString added in v0.1.47

func (me *ValueBool) AsString() string

func (*ValueBool) Clone added in v0.1.47

func (me *ValueBool) Clone() *Value

func (*ValueBool) GetBool added in v0.1.47

func (me *ValueBool) GetBool() bool

func (*ValueBool) GetRaw added in v0.1.47

func (me *ValueBool) GetRaw() any

func (*ValueBool) SetBool added in v0.1.47

func (me *ValueBool) SetBool(value bool)

func (*ValueBool) SetRaw added in v0.1.47

func (me *ValueBool) SetRaw(value any)

type ValueChoice added in v0.1.47

type ValueChoice struct {
	Value int
}

func (*ValueChoice) AsAnyPb added in v0.1.47

func (me *ValueChoice) AsAnyPb() *anypb.Any

func (*ValueChoice) AsString added in v0.1.47

func (me *ValueChoice) AsString() string

func (*ValueChoice) Clone added in v0.1.47

func (me *ValueChoice) Clone() *Value

func (*ValueChoice) GetChoice added in v0.1.47

func (me *ValueChoice) GetChoice() int

func (*ValueChoice) GetRaw added in v0.1.47

func (me *ValueChoice) GetRaw() any

func (*ValueChoice) SetChoice added in v0.1.47

func (me *ValueChoice) SetChoice(value int)

func (*ValueChoice) SetRaw added in v0.1.47

func (me *ValueChoice) SetRaw(value any)

type ValueConstructor added in v0.1.47

type ValueConstructor interface {
	Clone() *Value
}

type ValueEntityList added in v0.1.47

type ValueEntityList struct {
	Value []EntityId
}

func (*ValueEntityList) AsAnyPb added in v0.1.47

func (me *ValueEntityList) AsAnyPb() *anypb.Any

func (*ValueEntityList) AsString added in v0.1.47

func (me *ValueEntityList) AsString() string

func (*ValueEntityList) Clone added in v0.1.47

func (me *ValueEntityList) Clone() *Value

func (*ValueEntityList) GetEntityList added in v0.1.47

func (me *ValueEntityList) GetEntityList() []EntityId

func (*ValueEntityList) GetRaw added in v0.1.47

func (me *ValueEntityList) GetRaw() any

func (*ValueEntityList) SetEntityList added in v0.1.47

func (me *ValueEntityList) SetEntityList(value []EntityId)

func (*ValueEntityList) SetRaw added in v0.1.47

func (me *ValueEntityList) SetRaw(value any)

type ValueEntityReference added in v0.1.47

type ValueEntityReference struct {
	Value EntityId
}

func (*ValueEntityReference) AsAnyPb added in v0.1.47

func (me *ValueEntityReference) AsAnyPb() *anypb.Any

func (*ValueEntityReference) AsString added in v0.1.47

func (me *ValueEntityReference) AsString() string

func (*ValueEntityReference) Clone added in v0.1.47

func (me *ValueEntityReference) Clone() *Value

func (*ValueEntityReference) GetEntityReference added in v0.1.47

func (me *ValueEntityReference) GetEntityReference() EntityId

func (*ValueEntityReference) GetRaw added in v0.1.47

func (me *ValueEntityReference) GetRaw() any

func (*ValueEntityReference) SetEntityReference added in v0.1.47

func (me *ValueEntityReference) SetEntityReference(value EntityId)

func (*ValueEntityReference) SetRaw added in v0.1.47

func (me *ValueEntityReference) SetRaw(value any)

type ValueFloat added in v0.1.47

type ValueFloat struct {
	Value float64
}

func (*ValueFloat) AsAnyPb added in v0.1.47

func (me *ValueFloat) AsAnyPb() *anypb.Any

func (*ValueFloat) AsString added in v0.1.47

func (me *ValueFloat) AsString() string

func (*ValueFloat) Clone added in v0.1.47

func (me *ValueFloat) Clone() *Value

func (*ValueFloat) GetFloat added in v0.1.47

func (me *ValueFloat) GetFloat() float64

func (*ValueFloat) GetRaw added in v0.1.47

func (me *ValueFloat) GetRaw() any

func (*ValueFloat) SetFloat added in v0.1.47

func (me *ValueFloat) SetFloat(value float64)

func (*ValueFloat) SetRaw added in v0.1.47

func (me *ValueFloat) SetRaw(value any)

type ValueInt added in v0.1.47

type ValueInt struct {
	Value int
}

func (*ValueInt) AsAnyPb added in v0.1.47

func (me *ValueInt) AsAnyPb() *anypb.Any

func (*ValueInt) AsString added in v0.1.47

func (me *ValueInt) AsString() string

func (*ValueInt) Clone added in v0.1.47

func (me *ValueInt) Clone() *Value

func (*ValueInt) GetInt added in v0.1.47

func (me *ValueInt) GetInt() int

func (*ValueInt) GetRaw added in v0.1.47

func (me *ValueInt) GetRaw() any

func (*ValueInt) SetInt added in v0.1.47

func (me *ValueInt) SetInt(value int)

func (*ValueInt) SetRaw added in v0.1.47

func (me *ValueInt) SetRaw(value any)

type ValueString added in v0.1.47

type ValueString struct {
	Value string
}

func (*ValueString) AsAnyPb added in v0.1.47

func (me *ValueString) AsAnyPb() *anypb.Any

func (*ValueString) AsString added in v0.1.47

func (me *ValueString) AsString() string

func (*ValueString) Clone added in v0.1.47

func (me *ValueString) Clone() *Value

func (*ValueString) GetRaw added in v0.1.47

func (me *ValueString) GetRaw() any

func (*ValueString) GetString added in v0.1.47

func (me *ValueString) GetString() string

func (*ValueString) SetRaw added in v0.1.47

func (me *ValueString) SetRaw(value any)

func (*ValueString) SetString added in v0.1.47

func (me *ValueString) SetString(value string)

type ValueTimestamp added in v0.1.47

type ValueTimestamp struct {
	Value time.Time
}

func (*ValueTimestamp) AsAnyPb added in v0.1.47

func (me *ValueTimestamp) AsAnyPb() *anypb.Any

func (*ValueTimestamp) AsString added in v0.1.47

func (me *ValueTimestamp) AsString() string

func (*ValueTimestamp) Clone added in v0.1.47

func (me *ValueTimestamp) Clone() *Value

func (*ValueTimestamp) GetRaw added in v0.1.47

func (me *ValueTimestamp) GetRaw() any

func (*ValueTimestamp) GetTimestamp added in v0.1.47

func (me *ValueTimestamp) GetTimestamp() time.Time

func (*ValueTimestamp) SetRaw added in v0.1.47

func (me *ValueTimestamp) SetRaw(value any)

func (*ValueTimestamp) SetTimestamp added in v0.1.47

func (me *ValueTimestamp) SetTimestamp(value time.Time)

type ValueType added in v0.1.47

type ValueType string
const (
	VTInt             ValueType = "int"
	VTFloat           ValueType = "float"
	VTString          ValueType = "string"
	VTBool            ValueType = "bool"
	VTBinaryFile      ValueType = "binaryFile"
	VTEntityReference ValueType = "entityReference"
	VTTimestamp       ValueType = "timestamp"
	VTChoice          ValueType = "choice"
	VTEntityList      ValueType = "entityList"
)

func (*ValueType) As added in v0.1.47

func (me *ValueType) As(o ValueType) *ValueType

func (ValueType) AsString added in v0.1.47

func (me ValueType) AsString() string

func (*ValueType) IsBinaryFile added in v0.1.47

func (me *ValueType) IsBinaryFile() bool

func (*ValueType) IsBool added in v0.1.47

func (me *ValueType) IsBool() bool

func (*ValueType) IsChoice added in v0.1.47

func (me *ValueType) IsChoice() bool

func (*ValueType) IsEntityList added in v0.1.47

func (me *ValueType) IsEntityList() bool

func (*ValueType) IsEntityReference added in v0.1.47

func (me *ValueType) IsEntityReference() bool

func (*ValueType) IsFloat added in v0.1.47

func (me *ValueType) IsFloat() bool

func (*ValueType) IsInt added in v0.1.47

func (me *ValueType) IsInt() bool

func (*ValueType) IsNil added in v0.1.47

func (me *ValueType) IsNil() bool

func (*ValueType) IsString added in v0.1.47

func (me *ValueType) IsString() bool

func (*ValueType) IsTimestamp added in v0.1.47

func (me *ValueType) IsTimestamp() bool

func (ValueType) NewValue added in v0.1.47

func (me ValueType) NewValue(args ...any) *Value

func (*ValueType) Type added in v0.1.47

func (me *ValueType) Type() ValueType

type ValueTypeProvider added in v0.1.47

type ValueTypeProvider interface {
	Type() ValueType

	IsNil() bool
	IsInt() bool
	IsFloat() bool
	IsString() bool
	IsBool() bool
	IsBinaryFile() bool
	IsEntityReference() bool
	IsTimestamp() bool
	IsChoice() bool
	IsEntityList() bool
}

type WriteEventArgs added in v0.1.95

type WriteEventArgs struct {
	Ctx context.Context
	Req *Request
}

type WriteOpt

type WriteOpt int
const (
	WriteNormal WriteOpt = iota
	WriteChanges
)

type WriteTime added in v0.1.47

type WriteTime time.Time

func (*WriteTime) AsTime added in v0.1.47

func (me *WriteTime) AsTime() time.Time

func (*WriteTime) AsTimestampPb added in v0.1.47

func (me *WriteTime) AsTimestampPb() *qprotobufs.Timestamp

func (*WriteTime) AsTimestampPb2 added in v0.1.47

func (me *WriteTime) AsTimestampPb2() *timestamppb.Timestamp

func (*WriteTime) FromTime added in v0.1.47

func (me *WriteTime) FromTime(t time.Time) *WriteTime

func (*WriteTime) FromUnixNanos added in v0.1.48

func (me *WriteTime) FromUnixNanos(t int64) *WriteTime

Directories

Path Synopsis
qws

Jump to

Keyboard shortcuts

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