Documentation ¶
Index ¶
- Constants
- func NewPostgres(config PostgresConfig) data.Store
- func NewRedis(config RedisConfig) data.Store
- func NewWeb(config WebConfig) data.Store
- type Postgres
- func (s *Postgres) Connect(ctx context.Context)
- func (s *Postgres) CreateEntity(ctx context.Context, entityType, parentId, name string)
- func (s *Postgres) CreateSnapshot(ctx context.Context) data.Snapshot
- func (s *Postgres) DeleteEntity(ctx context.Context, entityId string)
- func (s *Postgres) Disconnect(ctx context.Context)
- func (s *Postgres) EntityExists(ctx context.Context, entityId string) bool
- func (s *Postgres) FieldExists(ctx context.Context, fieldName, entityType string) bool
- func (s *Postgres) FindEntities(ctx context.Context, entityType string) []string
- func (s *Postgres) GetEntity(ctx context.Context, entityId string) data.Entity
- func (s *Postgres) GetEntitySchema(ctx context.Context, entityType string) data.EntitySchema
- func (s *Postgres) GetEntityTypes(ctx context.Context) []string
- func (s *Postgres) GetFieldSchema(ctx context.Context, entityType, fieldName string) data.FieldSchema
- func (s *Postgres) IsConnected(ctx context.Context) bool
- func (s *Postgres) Notify(ctx context.Context, nc data.NotificationConfig, cb data.NotificationCallback) data.NotificationToken
- func (s *Postgres) ProcessNotifications(ctx context.Context)
- func (s *Postgres) Read(ctx context.Context, requests ...data.Request)
- func (s *Postgres) RestoreSnapshot(ctx context.Context, ss data.Snapshot)
- func (s *Postgres) SetEntity(ctx context.Context, e data.Entity)
- func (s *Postgres) SetEntitySchema(ctx context.Context, schema data.EntitySchema)
- func (s *Postgres) SetFieldSchema(ctx context.Context, entityType, fieldName string, schema data.FieldSchema)
- func (s *Postgres) Unnotify(ctx context.Context, token string)
- func (s *Postgres) UnnotifyCallback(ctx context.Context, token string, callback data.NotificationCallback)
- func (s *Postgres) Write(ctx context.Context, requests ...data.Request)
- type PostgresConfig
- type Redis
- func (s *Redis) Connect(ctx context.Context)
- func (s *Redis) CreateEntity(ctx context.Context, entityType, parentId, name string)
- func (s *Redis) CreateSnapshot(ctx context.Context) data.Snapshot
- func (s *Redis) DeleteEntity(ctx context.Context, entityId string)
- func (s *Redis) Disconnect(ctx context.Context)
- func (s *Redis) EntityExists(ctx context.Context, entityId string) bool
- func (s *Redis) FieldExists(ctx context.Context, fieldName, entityType string) bool
- func (s *Redis) FindEntities(ctx context.Context, entityType string) []string
- func (s *Redis) GetEntity(ctx context.Context, entityId string) data.Entity
- func (s *Redis) GetEntitySchema(ctx context.Context, entityType string) data.EntitySchema
- func (s *Redis) GetEntityTypes(ctx context.Context) []string
- func (s *Redis) GetFieldSchema(ctx context.Context, entityType, fieldName string) data.FieldSchema
- func (s *Redis) IsConnected(ctx context.Context) bool
- func (s *Redis) Notify(ctx context.Context, nc data.NotificationConfig, cb data.NotificationCallback) data.NotificationToken
- func (s *Redis) ProcessNotifications(ctx context.Context)
- func (s *Redis) Read(ctx context.Context, requests ...data.Request)
- func (s *Redis) ResolveIndirection(ctx context.Context, indirectField, entityId string) (string, string)
- func (s *Redis) RestoreSnapshot(ctx context.Context, ss data.Snapshot)
- func (s *Redis) SetEntity(ctx context.Context, e data.Entity)
- func (s *Redis) SetEntitySchema(ctx context.Context, newSchema data.EntitySchema)
- func (s *Redis) SetFieldSchema(ctx context.Context, entityType, fieldName string, value data.FieldSchema)
- func (s *Redis) Unnotify(ctx context.Context, e string)
- func (s *Redis) UnnotifyCallback(ctx context.Context, e string, c data.NotificationCallback)
- func (s *Redis) Write(ctx context.Context, requests ...data.Request)
- type RedisConfig
- type RedisKeyGenerator
- func (g *RedisKeyGenerator) GetEntityIdNotificationConfigKey(entityId, fieldName string) string
- func (g *RedisKeyGenerator) GetEntityKey(entityId string) string
- func (g *RedisKeyGenerator) GetEntitySchemaKey(entityType string) string
- func (g *RedisKeyGenerator) GetEntityTypeKey(entityType string) string
- func (g *RedisKeyGenerator) GetEntityTypeNotificationConfigKey(entityType, fieldName string) string
- func (g *RedisKeyGenerator) GetFieldKey(fieldName, entityId string) string
- func (g *RedisKeyGenerator) GetNotificationChannelKey(serviceId string) string
- type Web
- func (s *Web) Connect(ctx context.Context)
- func (s *Web) CreateEntity(ctx context.Context, entityType, parentId, name string)
- func (s *Web) CreateSnapshot(ctx context.Context) data.Snapshot
- func (s *Web) DeleteEntity(ctx context.Context, entityId string)
- func (s *Web) Disconnect(ctx context.Context)
- func (s *Web) EntityExists(ctx context.Context, entityId string) bool
- func (s *Web) FieldExists(ctx context.Context, fieldName, entityType string) bool
- func (s *Web) FindEntities(ctx context.Context, entityType string) []string
- func (s *Web) GetEntity(ctx context.Context, entityId string) data.Entity
- func (s *Web) GetEntitySchema(ctx context.Context, entityType string) data.EntitySchema
- func (s *Web) GetEntityTypes(ctx context.Context) []string
- func (s *Web) IsConnected(ctx context.Context) bool
- func (s *Web) Notify(ctx context.Context, config data.NotificationConfig, ...) data.NotificationToken
- func (s *Web) ProcessNotifications(ctx context.Context)
- func (s *Web) Read(ctx context.Context, requests ...data.Request)
- func (s *Web) RestoreSnapshot(ctx context.Context, ss data.Snapshot)
- func (s *Web) SetEntity(ctx context.Context, e data.Entity)
- func (s *Web) SetEntitySchema(ctx context.Context, schema data.EntitySchema)
- func (s *Web) Unnotify(ctx context.Context, token string)
- func (s *Web) UnnotifyCallback(ctx context.Context, token string, cb data.NotificationCallback)
- func (s *Web) Write(ctx context.Context, requests ...data.Request)
- type WebConfig
Constants ¶
View Source
const (
MaxStreamLength = 50
)
View Source
const (
NotificationExpiryDuration = time.Minute
)
Variables ¶
This section is empty.
Functions ¶
func NewPostgres ¶ added in v0.0.36
func NewPostgres(config PostgresConfig) data.Store
func NewRedis ¶
func NewRedis(config RedisConfig) data.Store
Types ¶
type Postgres ¶ added in v0.0.36
type Postgres struct {
// contains filtered or unexported fields
}
func (*Postgres) CreateEntity ¶ added in v0.0.36
func (*Postgres) CreateSnapshot ¶ added in v0.0.36
func (*Postgres) DeleteEntity ¶ added in v0.0.36
Fix DeleteEntity to clean up notifications
func (*Postgres) Disconnect ¶ added in v0.0.36
func (*Postgres) EntityExists ¶ added in v0.0.36
func (*Postgres) FieldExists ¶ added in v0.0.36
func (*Postgres) FindEntities ¶ added in v0.0.36
func (*Postgres) GetEntitySchema ¶ added in v0.0.36
func (*Postgres) GetEntityTypes ¶ added in v0.0.36
func (*Postgres) GetFieldSchema ¶ added in v0.0.36
func (*Postgres) IsConnected ¶ added in v0.0.36
func (*Postgres) Notify ¶ added in v0.0.36
func (s *Postgres) Notify(ctx context.Context, nc data.NotificationConfig, cb data.NotificationCallback) data.NotificationToken
func (*Postgres) ProcessNotifications ¶ added in v0.0.36
Fix notification processing to avoid lock copying
func (*Postgres) RestoreSnapshot ¶ added in v0.0.36
func (*Postgres) SetEntitySchema ¶ added in v0.0.36
func (s *Postgres) SetEntitySchema(ctx context.Context, schema data.EntitySchema)
func (*Postgres) SetFieldSchema ¶ added in v0.0.36
func (*Postgres) UnnotifyCallback ¶ added in v0.0.36
type PostgresConfig ¶ added in v0.0.36
type PostgresConfig struct {
ConnectionString string
}
type Redis ¶
type Redis struct {
// contains filtered or unexported fields
}
func (*Redis) CreateEntity ¶
func (*Redis) Disconnect ¶
func (*Redis) EntityExists ¶
func (*Redis) FieldExists ¶
func (*Redis) FindEntities ¶
func (*Redis) GetEntitySchema ¶
func (*Redis) GetFieldSchema ¶
func (*Redis) Notify ¶
func (s *Redis) Notify(ctx context.Context, nc data.NotificationConfig, cb data.NotificationCallback) data.NotificationToken
func (*Redis) ProcessNotifications ¶
func (*Redis) ResolveIndirection ¶
func (*Redis) RestoreSnapshot ¶
func (*Redis) SetEntitySchema ¶
func (s *Redis) SetEntitySchema(ctx context.Context, newSchema data.EntitySchema)
func (*Redis) SetFieldSchema ¶
func (*Redis) UnnotifyCallback ¶
type RedisConfig ¶
type RedisKeyGenerator ¶
type RedisKeyGenerator struct{}
schema:entity:<type> -> DatabaseEntitySchema schema:field:<name> -> DatabaseFieldSchema instance:entity:<entityId> -> DatabaseEntity instance:field:<name>:<entityId> -> DatabaseField instance:type:<entityType> -> []string{entityId...} instance:notification-config:<entityId>:<fieldName> -> []string{subscriptionId...} instance:notification-config:<entityType>:<fieldName> -> []string{subscriptionId...}
func (*RedisKeyGenerator) GetEntityIdNotificationConfigKey ¶
func (g *RedisKeyGenerator) GetEntityIdNotificationConfigKey(entityId, fieldName string) string
func (*RedisKeyGenerator) GetEntityKey ¶
func (g *RedisKeyGenerator) GetEntityKey(entityId string) string
func (*RedisKeyGenerator) GetEntitySchemaKey ¶
func (g *RedisKeyGenerator) GetEntitySchemaKey(entityType string) string
func (*RedisKeyGenerator) GetEntityTypeKey ¶
func (g *RedisKeyGenerator) GetEntityTypeKey(entityType string) string
func (*RedisKeyGenerator) GetEntityTypeNotificationConfigKey ¶
func (g *RedisKeyGenerator) GetEntityTypeNotificationConfigKey(entityType, fieldName string) string
func (*RedisKeyGenerator) GetFieldKey ¶
func (g *RedisKeyGenerator) GetFieldKey(fieldName, entityId string) string
func (*RedisKeyGenerator) GetNotificationChannelKey ¶
func (g *RedisKeyGenerator) GetNotificationChannelKey(serviceId string) string
type Web ¶ added in v0.0.9
type Web struct {
// contains filtered or unexported fields
}
func (*Web) CreateEntity ¶ added in v0.0.9
func (*Web) CreateSnapshot ¶ added in v0.0.9
func (*Web) DeleteEntity ¶ added in v0.0.9
func (*Web) Disconnect ¶ added in v0.0.9
func (*Web) EntityExists ¶ added in v0.0.9
func (*Web) FieldExists ¶ added in v0.0.9
func (*Web) FindEntities ¶ added in v0.0.9
func (*Web) GetEntitySchema ¶ added in v0.0.9
func (*Web) GetEntityTypes ¶ added in v0.0.9
func (*Web) Notify ¶ added in v0.0.9
func (s *Web) Notify(ctx context.Context, config data.NotificationConfig, cb data.NotificationCallback) data.NotificationToken
func (*Web) ProcessNotifications ¶ added in v0.0.9
func (*Web) RestoreSnapshot ¶ added in v0.0.9
func (*Web) SetEntitySchema ¶ added in v0.0.9
func (s *Web) SetEntitySchema(ctx context.Context, schema data.EntitySchema)
func (*Web) UnnotifyCallback ¶ added in v0.0.9
Click to show internal directories.
Click to hide internal directories.