feat(storage): add native PostgreSQL runtime and verified offline application import
Build and publish container images / images (push) Failing after 12m29s
Build and publish container images / images (push) Failing after 12m29s
This commit is contained in:
1 parent
96065d1e89
commit
0ba1dcfef0
243 files changed
+21441
-3090
No files matched your search
@@ -84,7 +84,7 @@ func (s *Store) ImportFeedSubscriptions(ctx context.Context, domain, owner strin
|
||||
ids := []string{}
|
||||
err := s.feedWrite(ctx, domain, owner, func(tx *sql.Tx) error {
|
||||
var oldHash, result string
|
||||
err := tx.QueryRowContext(ctx, `SELECT input_hash,result FROM feed_import_receipts WHERE domain_uuid=? AND owner_uuid=? AND request_id=?`, domain, owner, input.RequestID).Scan(&oldHash, &result)
|
||||
err := tx.QueryRowContext(ctx, `SELECT input_hash,result FROM feed_import_receipts WHERE domain_uuid=`+s.sqlParam(1)+` AND owner_uuid=`+s.sqlParam(2)+` AND request_id=`+s.sqlParam(3), domain, owner, input.RequestID).Scan(&oldHash, &result)
|
||||
if err == nil {
|
||||
if oldHash != hash {
|
||||
return ErrTaskConflict
|
||||
@@ -94,7 +94,7 @@ func (s *Store) ImportFeedSubscriptions(ctx context.Context, domain, owner strin
|
||||
if !errors.Is(err, sql.ErrNoRows) {
|
||||
return err
|
||||
}
|
||||
rows, err := tx.QueryContext(ctx, `SELECT uuid,version,provider,url FROM feed_sources WHERE domain_uuid=? AND owner_uuid=?`, domain, owner)
|
||||
rows, err := tx.QueryContext(ctx, `SELECT uuid,version,provider,url FROM feed_sources WHERE domain_uuid=`+s.sqlParam(1)+` AND owner_uuid=`+s.sqlParam(2), domain, owner)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -124,7 +124,7 @@ func (s *Store) ImportFeedSubscriptions(ctx context.Context, domain, owner strin
|
||||
}
|
||||
}
|
||||
var receipts int
|
||||
if err = tx.QueryRowContext(ctx, `SELECT count(*) FROM feed_import_receipts WHERE domain_uuid=? AND owner_uuid=?`, domain, owner).Scan(&receipts); err != nil {
|
||||
if err = tx.QueryRowContext(ctx, `SELECT count(*) FROM feed_import_receipts WHERE domain_uuid=`+s.sqlParam(1)+` AND owner_uuid=`+s.sqlParam(2), domain, owner).Scan(&receipts); err != nil {
|
||||
return err
|
||||
}
|
||||
if receipts >= 1000 {
|
||||
@@ -132,13 +132,13 @@ func (s *Store) ImportFeedSubscriptions(ctx context.Context, domain, owner strin
|
||||
}
|
||||
for _, entry := range input.Entries {
|
||||
id := uuid.NewString()
|
||||
if _, err = tx.ExecContext(ctx, `INSERT INTO feed_sources(uuid,domain_uuid,owner_uuid,provider,title,folder,url,version,enabled,interval_seconds) VALUES(?,?,?,'local',?,?,?,1,?,?)`, id, domain, owner, entry.Title, entry.Folder, entry.URL, input.Enabled, input.Interval); err != nil {
|
||||
if _, err = tx.ExecContext(ctx, `INSERT INTO feed_sources(uuid,domain_uuid,owner_uuid,provider,title,folder,url,version,enabled,interval_seconds) VALUES(`+s.sqlParam(1)+`,`+s.sqlParam(2)+`,`+s.sqlParam(3)+`,'local',`+s.sqlParam(4)+`,`+s.sqlParam(5)+`,`+s.sqlParam(6)+`,1,`+s.sqlParam(7)+`,`+s.sqlParam(8)+`)`, id, domain, owner, entry.Title, entry.Folder, entry.URL, boolToInt(input.Enabled), input.Interval); err != nil {
|
||||
return err
|
||||
}
|
||||
ids = append(ids, id)
|
||||
}
|
||||
encoded, _ := json.Marshal(ids)
|
||||
_, err = tx.ExecContext(ctx, `INSERT INTO feed_import_receipts VALUES(?,?,?,?,?)`, domain, owner, input.RequestID, hash, string(encoded))
|
||||
_, err = tx.ExecContext(ctx, `INSERT INTO feed_import_receipts VALUES(`+s.sqlParam(1)+`,`+s.sqlParam(2)+`,`+s.sqlParam(3)+`,`+s.sqlParam(4)+`,`+s.sqlParam(5)+`)`, domain, owner, input.RequestID, hash, string(encoded))
|
||||
return err
|
||||
})
|
||||
if err != nil {
|
||||
|
||||
Reference in new issue
Block a user