feat(storage): add native PostgreSQL runtime and verified offline application import
Build and publish container images / images (push) Failing after 12m29s

This commit is contained in:
Anya Tokugawa committed 2026-11-15 05:47:14 +09:00
1 parent 96065d1e89
commit 0ba1dcfef0
243 files changed
+21441 -3090

No files matched your search

+13 -10
View File
@@ -32,12 +32,12 @@ func (s *Store) CreateTaskDAVCollection(ctx context.Context, domain, actor, path
item := TaskRecord{UUID: uuid.NewString(), Kind: "project", Title: title, Status: "todo", Bucket: "inbox"}
return s.saveTask(ctx, domain, actor, item, 0, func(tx *sql.Tx, v *TaskRecord, old TaskRecord) error {
if credential != "" {
if err := taskDAVCredentialAllowed(ctx, tx, domain, actor, credential, true); err != nil {
if err := s.taskDAVCredentialAllowed(ctx, tx, domain, actor, credential, true); err != nil {
return err
}
}
var exists bool
if err := tx.QueryRowContext(ctx, `SELECT EXISTS(SELECT 1 FROM organizer_dav_collections WHERE domain_uuid=? AND path=?)`, domain, path).Scan(&exists); err != nil {
if err := tx.QueryRowContext(ctx, `SELECT EXISTS(SELECT 1 FROM organizer_dav_collections WHERE domain_uuid=`+s.sqlParam(1)+` AND path=`+s.sqlParam(2)+`)`, domain, path).Scan(&exists); err != nil {
return err
}
if exists {
@@ -55,7 +55,7 @@ func (s *Store) CreateTaskDAVCollection(ctx context.Context, domain, actor, path
}
}
var count int
if err := tx.QueryRowContext(ctx, `SELECT count(*) FROM organizer_dav_collections WHERE domain_uuid=? AND owner_uuid=?`, domain, actor).Scan(&count); err != nil {
if err := tx.QueryRowContext(ctx, `SELECT count(*) FROM organizer_dav_collections WHERE domain_uuid=`+s.sqlParam(1)+` AND owner_uuid=`+s.sqlParam(2)+``, domain, actor).Scan(&count); err != nil {
return err
}
if count >= 256 {
@@ -68,13 +68,13 @@ func (s *Store) CreateTaskDAVCollection(ctx context.Context, domain, actor, path
func (s *Store) IsTaskDAVCollection(ctx context.Context, domain, path string) (bool, error) {
var found bool
err := s.DB.QueryRowContext(ctx, `SELECT EXISTS(SELECT 1 FROM organizer_dav_collections WHERE domain_uuid=? AND path=?)`, domain, path).Scan(&found)
err := s.DB.QueryRowContext(ctx, `SELECT EXISTS(SELECT 1 FROM organizer_dav_collections WHERE domain_uuid=`+s.sqlParam(1)+` AND path=`+s.sqlParam(2)+`)`, domain, path).Scan(&found)
return found, err
}
func (s *Store) TaskDAVCollection(ctx context.Context, domain, actor, path string) (TaskRecord, error) {
var project string
if err := s.DB.QueryRowContext(ctx, `SELECT project_uuid FROM organizer_dav_collections WHERE domain_uuid=? AND owner_uuid=? AND path=?`, domain, actor, path).Scan(&project); err != nil {
if err := s.DB.QueryRowContext(ctx, `SELECT project_uuid FROM organizer_dav_collections WHERE domain_uuid=`+s.sqlParam(1)+` AND owner_uuid=`+s.sqlParam(2)+` AND path=`+s.sqlParam(3)+``, domain, actor, path).Scan(&project); err != nil {
return TaskRecord{}, err
}
v, err := s.GetTask(ctx, domain, actor, project)
@@ -85,10 +85,10 @@ func (s *Store) TaskDAVCollection(ctx context.Context, domain, actor, path strin
}
func (s *Store) TaskDAVCollections(ctx context.Context, domain, actor string) ([]TaskRecord, error) {
if err := taskActor(ctx, s.DB, domain, actor, false); err != nil {
if err := s.taskActor(ctx, s.DB, domain, actor, false); err != nil {
return nil, err
}
rows, err := s.DB.QueryContext(ctx, `SELECT i.uuid FROM organizer_dav_collections c JOIN organizer_items i ON i.domain_uuid=c.domain_uuid AND i.uuid=c.project_uuid AND i.owner_uuid=c.owner_uuid WHERE c.domain_uuid=? AND c.owner_uuid=? AND i.archived=0 ORDER BY c.path LIMIT 257`, domain, actor)
rows, err := s.DB.QueryContext(ctx, `SELECT i.uuid FROM organizer_dav_collections c JOIN organizer_items i ON i.domain_uuid=c.domain_uuid AND i.uuid=c.project_uuid AND i.owner_uuid=c.owner_uuid WHERE c.domain_uuid=`+s.sqlParam(1)+` AND c.owner_uuid=`+s.sqlParam(2)+` AND i.archived=0 ORDER BY c.path LIMIT 257`, domain, actor)
if err != nil {
return nil, err
}
@@ -122,7 +122,10 @@ func (s *Store) TaskDAVCollections(ctx context.Context, domain, actor string) ([
return items, nil
}
func taskDAVIndexKey(project, value string) string {
func (s *Store) taskDAVIndexKey(project, value string) string {
if s.sqlBackend == storePostgreSQL {
return nativeTaskDAVIndexKey(project, value)
}
if project == "" {
return value
}
@@ -131,12 +134,12 @@ func taskDAVIndexKey(project, value string) string {
return "\x00" + project + "\x00" + value
}
func taskDAVProjectTx(ctx context.Context, tx *sql.Tx, domain, actor, project string) (string, error) {
func (s *Store) taskDAVProjectTx(ctx context.Context, tx *sql.Tx, domain, actor, project string) (string, error) {
if project == "" {
return "", nil
}
var found bool
err := tx.QueryRowContext(ctx, `SELECT EXISTS(SELECT 1 FROM organizer_dav_collections WHERE domain_uuid=? AND owner_uuid=? AND project_uuid=?)`, domain, actor, project).Scan(&found)
err := tx.QueryRowContext(ctx, `SELECT EXISTS(SELECT 1 FROM organizer_dav_collections WHERE domain_uuid=`+s.sqlParam(1)+` AND owner_uuid=`+s.sqlParam(2)+` AND project_uuid=`+s.sqlParam(3)+`)`, domain, actor, project).Scan(&found)
if found {
return project, err
}