post.h (544B)
1 #pragma once 2 3 #include <stdbool.h> 4 5 typedef struct { 6 int id; 7 char *title; 8 char *summary; 9 char *content; 10 char *date; 11 bool *is_public; 12 } post_t; 13 14 typedef struct { 15 post_t *result; 16 int len; 17 } post_result_t; 18 19 void post_init(post_t *post); 20 void post_free(post_t *post); 21 void post_result_free(post_result_t *post_result); 22 bool post_changed(post_t *post, post_t *changes); 23 post_result_t *db_post_search(char *db, char *title); 24 post_t *db_post_get(char *db, int id); 25 bool db_post_update(char *db, int id, post_t *post, post_t *changes);