Skip to main content

Keysets

define-keyset

name string keyset string  string

name string  string

Define keyset as NAME with KEYSET, or if unspecified, read NAME from message payload as keyset, similarly to 'read-keyset'. If keyset NAME already exists, keyset will be enforced before updating to new value.

(define-keyset 'admin-keyset (read-keyset "keyset"))
(define-keyset 'admin-keyset (read-keyset "keyset"))

Top level only: this function will fail if used in module code.

enforce-keyset

guard guard  bool

keysetname string  bool

Execute GUARD, or defined keyset KEYSETNAME, to enforce desired predicate logic.

(enforce-keyset 'admin-keyset)(enforce-keyset row-guard)
(enforce-keyset 'admin-keyset)(enforce-keyset row-guard)

keys-2

count integer matched integer  bool

Keyset predicate function to match at least 2 keys in keyset.

pact> (keys-2 3 1)false
pact> (keys-2 3 1)false

keys-all

count integer matched integer  bool

Keyset predicate function to match all keys in keyset.

pact> (keys-all 3 3)true
pact> (keys-all 3 3)true

keys-any

count integer matched integer  bool

Keyset predicate function to match any (at least 1) key in keyset.

pact> (keys-any 10 1)true
pact> (keys-any 10 1)true

read-keyset

key string  keyset

Read KEY from message data body as keyset ({ "keys": KEYLIST, "pred": PREDFUN }). PREDFUN should resolve to a keys predicate.

(read-keyset "admin-keyset")
(read-keyset "admin-keyset")

Receive important developer updates