Documentation
¶
Overview ¶
Package postgres implements AstraEngine repositories using pgx and PostgreSQL.
Index ¶
- type AdminAuthRepo
- type ChatRepo
- func (r *ChatRepo) FilterOptions(ctx context.Context, limit int) (storage.ChatFilterOptions, error)
- func (r *ChatRepo) FindByPlatformID(ctx context.Context, platform, chatID string) (*storage.Chat, error)
- func (r *ChatRepo) List(ctx context.Context) ([]storage.Chat, error)
- func (r *ChatRepo) Save(ctx context.Context, chat *storage.Chat) error
- type ControlTicketRepo
- type IdentityRepo
- func (r *IdentityRepo) FindByID(ctx context.Context, id string) (*storage.Principal, error)
- func (r *IdentityRepo) Resolve(ctx context.Context, identity storage.PlatformIdentity) (_ *storage.Principal, err error)
- func (r *IdentityRepo) Roles(ctx context.Context, id string) ([]string, uint64, error)
- func (r *IdentityRepo) SetRoles(ctx context.Context, id string, roles []string) (_ uint64, err error)
- type OperationRepo
- func (r *OperationRepo) Claim(ctx context.Context, in *storage.OperationRecord, now time.Time) (*storage.OperationRecord, storage.OperationClaim, error)
- func (r *OperationRepo) Complete(ctx context.Context, p, o string, v uint, h []byte, executionID string, ...) (*storage.OperationRecord, error)
- func (r *OperationRepo) Lookup(ctx context.Context, p, o string, v uint, h []byte, now time.Time) (*storage.OperationRecord, error)
- func (r *OperationRepo) UpdateProgress(ctx context.Context, p, o string, v uint, h []byte, executionID string, ...) (*storage.OperationRecord, error)
- type SessionRepo
- func (r *SessionRepo) Delete(ctx context.Context, key string) error
- func (r *SessionRepo) Get(ctx context.Context, key string) ([]byte, error)
- func (r *SessionRepo) Set(ctx context.Context, key string, value []byte, ttl time.Duration) error
- func (r *SessionRepo) WithSessionLock(ctx context.Context, key string, fn func() error) error
- type Store
- func (s *Store) AdminAuth() storage.AdminAuthRepository
- func (s *Store) AdminMaintenance() storage.AdminMaintenance
- func (s *Store) Chats() storage.ChatRepository
- func (s *Store) CleanupAdmin(ctx context.Context, now time.Time, limit int) (storage.AdminMaintenanceCounts, error)
- func (s *Store) Close()
- func (s *Store) ControlTickets() storage.ControlTicketRepository
- func (s *Store) EnsureSchema(ctx context.Context) error
- func (s *Store) Identities() storage.IdentityRepository
- func (s *Store) Operations() storage.OperationRepository
- func (s *Store) Sessions() storage.SessionRepository
- func (s *Store) Users() storage.UserRepository
- type UserRepo
- func (r *UserRepo) FilterOptions(ctx context.Context, limit int) (storage.UserFilterOptions, error)
- func (r *UserRepo) FindByID(ctx context.Context, id string) (*storage.User, error)
- func (r *UserRepo) FindByPlatformID(ctx context.Context, platform, platformID string) (*storage.User, error)
- func (r *UserRepo) List(ctx context.Context) ([]storage.User, error)
- func (r *UserRepo) Save(ctx context.Context, user *storage.User) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AdminAuthRepo ¶ added in v2.0.1
type AdminAuthRepo struct {
// contains filtered or unexported fields
}
func (*AdminAuthRepo) AdminSessions ¶ added in v2.0.1
func (r *AdminAuthRepo) AdminSessions() storage.AdminSessionRepository
func (*AdminAuthRepo) LoginGrants ¶ added in v2.0.1
func (r *AdminAuthRepo) LoginGrants() storage.AdminLoginGrantRepository
type ChatRepo ¶
type ChatRepo struct {
// contains filtered or unexported fields
}
func (*ChatRepo) FilterOptions ¶ added in v2.0.1
func (*ChatRepo) FindByPlatformID ¶
type ControlTicketRepo ¶ added in v2.0.1
type ControlTicketRepo struct {
// contains filtered or unexported fields
}
func (*ControlTicketRepo) Consume ¶ added in v2.0.1
func (r *ControlTicketRepo) Consume(ctx context.Context, audience string, hash []byte, now time.Time) (*storage.ControlTicket, error)
func (*ControlTicketRepo) Create ¶ added in v2.0.1
func (r *ControlTicketRepo) Create(ctx context.Context, ticket *storage.ControlTicket) error
type IdentityRepo ¶ added in v2.0.1
type IdentityRepo struct {
// contains filtered or unexported fields
}
IdentityRepo stores Astra principals, platform identity mappings, and roles.
func (*IdentityRepo) Resolve ¶ added in v2.0.1
func (r *IdentityRepo) Resolve(ctx context.Context, identity storage.PlatformIdentity) (_ *storage.Principal, err error)
type OperationRepo ¶ added in v2.0.1
type OperationRepo struct {
// contains filtered or unexported fields
}
func (*OperationRepo) Claim ¶ added in v2.0.1
func (r *OperationRepo) Claim(ctx context.Context, in *storage.OperationRecord, now time.Time) (*storage.OperationRecord, storage.OperationClaim, error)
func (*OperationRepo) UpdateProgress ¶ added in v2.0.1
func (r *OperationRepo) UpdateProgress(ctx context.Context, p, o string, v uint, h []byte, executionID string, progress storage.OperationProgressUpdate, now time.Time) (*storage.OperationRecord, error)
type SessionRepo ¶
type SessionRepo struct {
// contains filtered or unexported fields
}
func (*SessionRepo) WithSessionLock ¶ added in v2.0.2
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store groups PostgreSQL-backed user, chat and session repositories.
func NewWithPool ¶
func (*Store) AdminAuth ¶ added in v2.0.1
func (s *Store) AdminAuth() storage.AdminAuthRepository
func (*Store) AdminMaintenance ¶ added in v2.0.1
func (s *Store) AdminMaintenance() storage.AdminMaintenance
func (*Store) Chats ¶
func (s *Store) Chats() storage.ChatRepository
func (*Store) CleanupAdmin ¶ added in v2.0.1
func (*Store) ControlTickets ¶ added in v2.0.1
func (s *Store) ControlTickets() storage.ControlTicketRepository
func (*Store) EnsureSchema ¶
EnsureSchema creates the standard AstraEngine tables when missing.
func (*Store) Identities ¶ added in v2.0.1
func (s *Store) Identities() storage.IdentityRepository
func (*Store) Operations ¶ added in v2.0.1
func (s *Store) Operations() storage.OperationRepository
func (*Store) Sessions ¶
func (s *Store) Sessions() storage.SessionRepository
func (*Store) Users ¶
func (s *Store) Users() storage.UserRepository
type UserRepo ¶
type UserRepo struct {
// contains filtered or unexported fields
}