mirror of
https://github.com/openziti/zrok.git
synced 2025-02-22 05:01:01 +01:00
limit_check_lock (#287)
This commit is contained in:
parent
fecb8952c8
commit
f0b0a959f0
17
controller/store/limitCheckLock.go
Normal file
17
controller/store/limitCheckLock.go
Normal file
@ -0,0 +1,17 @@
|
||||
package store
|
||||
|
||||
import (
|
||||
"github.com/jmoiron/sqlx"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
func (str *Store) LimitCheckLock(acctId int, trx *sqlx.Tx) error {
|
||||
rows, err := trx.Queryx("select * from limit_check_locks where account_id = $1 for update", acctId)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "error preparing limit_check_locks select statement")
|
||||
}
|
||||
if !rows.Next() {
|
||||
return errors.Errorf("no limit_check_locks entry for account_id '%d'", acctId)
|
||||
}
|
||||
return nil
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
-- +migrate Up
|
||||
|
||||
create table limit_check_locks (
|
||||
id serial primary key,
|
||||
account_id integer not null references accounts (id),
|
||||
updated_at timestamptz not null default(current_timestamp)
|
||||
);
|
@ -22,8 +22,9 @@ type Model struct {
|
||||
}
|
||||
|
||||
type Config struct {
|
||||
Path string `cf:"+secret"`
|
||||
Type string
|
||||
Path string `cf:"+secret"`
|
||||
Type string
|
||||
EnableLocking bool
|
||||
}
|
||||
|
||||
type Store struct {
|
||||
|
Loading…
Reference in New Issue
Block a user