MCPcopy Create free account
hub / github.com/ElementsProject/lightning / param_mode

Function param_mode

lightningd/datastore.c:33–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31};
32
33static struct command_result *param_mode(struct command *cmd,
34 const char *name,
35 const char *buffer,
36 const jsmntok_t *tok,
37 enum ds_mode **mode)
38{
39 *mode = tal(cmd, enum ds_mode);
40 if (json_tok_streq(buffer, tok, "must-create"))
41 **mode = DS_MUST_NOT_EXIST;
42 else if (json_tok_streq(buffer, tok, "must-replace"))
43 **mode = DS_MUST_EXIST;
44 else if (json_tok_streq(buffer, tok, "create-or-replace"))
45 **mode = 0;
46 else if (json_tok_streq(buffer, tok, "must-append"))
47 **mode = DS_MUST_EXIST | DS_APPEND;
48 else if (json_tok_streq(buffer, tok, "create-or-append"))
49 **mode = DS_APPEND;
50 else
51 return command_fail_badparam(cmd, name, buffer, tok,
52 "should be 'must-create',"
53 " 'must-replace',"
54 " 'create-or-replace',"
55 " 'must-append',"
56 " or 'create-or-append'");
57
58 return NULL;
59}
60
61static struct command_result *param_list_or_string(struct command *cmd,
62 const char *name,

Callers

nothing calls this directly

Calls 2

json_tok_streqFunction · 0.85
command_fail_badparamFunction · 0.50

Tested by

no test coverage detected