mirror of
https://github.com/openziti/zrok.git
synced 2025-06-20 09:48:07 +02: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)
|
||||||
|
);
|
@ -24,6 +24,7 @@ type Model struct {
|
|||||||
type Config struct {
|
type Config struct {
|
||||||
Path string `cf:"+secret"`
|
Path string `cf:"+secret"`
|
||||||
Type string
|
Type string
|
||||||
|
EnableLocking bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type Store struct {
|
type Store struct {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user