Documentation
¶
Index ¶
- type GormService
- func (s *GormService) Create(ctx context.Context, current *models.ResponseRecord) error
- func (s *GormService) Delete(ctx context.Context, id string) error
- func (s *GormService) Get(ctx context.Context, id string, kinds ...models.ResponseRecordKind) (*models.ResponseRecord, error)
- func (s *GormService) List(ctx context.Context, kinds []models.ResponseRecordKind, parentID string) ([]*models.ResponseRecord, error)
- func (s *GormService) SetLogger(l *slog.Logger)
- func (s *GormService) Update(ctx context.Context, current *models.ResponseRecord) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GormService ¶ added in v0.4.0
type GormService struct {
// contains filtered or unexported fields
}
GormService owns response records in the response_records table. Payload and input stay opaque JSON, parent references stay soft.
func NewGormService ¶ added in v0.4.0
func NewGormService(handle *gorm.DB) *GormService
NewGormService constructs a GormService on the base handle. Construction performs no I/O. The handle is stored; each call derives its chain from it, so reused chains never leak conditions across calls.
func (*GormService) Create ¶ added in v0.4.0
func (s *GormService) Create(ctx context.Context, current *models.ResponseRecord) error
Create persists a new record: one public method, one transaction. Existing IDs are overwritten, matching the previous Put behavior.
func (*GormService) Delete ¶ added in v0.4.0
func (s *GormService) Delete(ctx context.Context, id string) error
Delete removes a record. Missing rows are not errors.
func (*GormService) Get ¶ added in v0.4.0
func (s *GormService) Get(ctx context.Context, id string, kinds ...models.ResponseRecordKind) (*models.ResponseRecord, error)
Get returns the record by ID, optionally asserting its kind.
func (*GormService) List ¶ added in v0.4.0
func (s *GormService) List(ctx context.Context, kinds []models.ResponseRecordKind, parentID string) ([]*models.ResponseRecord, error)
List returns records of the given kinds (empty kinds = all), oldest first. ParentID filters thread children and run bindings when non-empty.
func (*GormService) SetLogger ¶ added in v0.4.0
func (s *GormService) SetLogger(l *slog.Logger)
SetLogger wires structured logging (called once from server.New).
func (*GormService) Update ¶ added in v0.4.0
func (s *GormService) Update(ctx context.Context, current *models.ResponseRecord) error
Update rewrites a record in place: one public method, one transaction. Missing rows return the not-found sentinel.