feat: import Sea vHost single-server testing release
This commit is contained in:
commit
248badd33e
441 files changed
+63221
No files matched your search
@@ -0,0 +1,21 @@
|
||||
package store
|
||||
|
||||
import "context"
|
||||
|
||||
// A single transaction prevents filing and routing changes from partially
|
||||
// succeeding, and treats saving an unchanged policy as a successful operation.
|
||||
func (s *Store) UpdateDomainPolicy(ctx context.Context, id uint64, mode, target, status, number, note string) error {
|
||||
tx, err := s.db.BeginTx(ctx, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer tx.Rollback()
|
||||
var found uint64
|
||||
if err = tx.QueryRowContext(ctx, `SELECT id FROM domains WHERE id=? AND kind='custom' FOR UPDATE`, id).Scan(&found); err != nil {
|
||||
return ErrNotFound
|
||||
}
|
||||
if _, err = tx.ExecContext(ctx, `UPDATE domains SET resolution_mode=?,cname_target=NULLIF(?,''),filing_status=?,filing_number=NULLIF(?,''),filing_note=NULLIF(?,'') WHERE id=?`, mode, target, status, number, note, id); err != nil {
|
||||
return err
|
||||
}
|
||||
return tx.Commit()
|
||||
}
|
||||
Reference in new issue
Block a user