Monorepo for Tangled
tangled.org
1package db
2
3import (
4 "context"
5 "database/sql"
6 "errors"
7)
8
9func MarkKnotAclNative(ctx context.Context, e Execer, domain string) error {
10 _, err := e.ExecContext(
11 ctx,
12 `insert into knot_acl_native (domain) values (?) on conflict (domain) do nothing`,
13 domain,
14 )
15 return err
16}
17
18func IsKnotAclNative(ctx context.Context, e Execer, domain string) (bool, error) {
19 var one int
20 err := e.QueryRowContext(ctx, `select 1 from knot_acl_native where domain = ?`, domain).Scan(&one)
21 if errors.Is(err, sql.ErrNoRows) {
22 return false, nil
23 }
24 if err != nil {
25 return false, err
26 }
27 return true, nil
28}