1 /* Blerg is (C) 2011 The Dominion of Awesome, and is distributed under a
2 * BSD-style license. Please see the COPYING file for details.
7 #include <yajl/yajl_gen.h>
11 void json_generate_one_record(yajl_gen g, const char *author, struct blerg *b, uint64_t record) {
16 if (!blerg_fetch(b, record, &data, &len)) {
17 fprintf(stderr, "Could not fetch record\n");
23 yajl_gen_string(g, "author", 6);
24 yajl_gen_string(g, author, strlen(author));
26 yajl_gen_string(g, "record", 6);
27 snprintf(number, 21, "%llu", record);
28 yajl_gen_string(g, number, strlen(number));
29 yajl_gen_string(g, "timestamp", 9);
30 yajl_gen_integer(g, blerg_get_timestamp(b, record));
31 yajl_gen_string(g, "data", 4);
32 yajl_gen_string(g, data, len);
33 yajl_gen_map_close(g);