<commit_before>struct PgqTriggerEvent {
	const char *table_name;
	const char *queue_name;
	const char *ignore_list;
	const char *pkey_list;
	char op_type;
	bool skip;

	const char *attkind;
	int attkind_len;

	struct PgqTableInfo *info;

	StringInfo ev_type;
	StringInfo ev_data;
	StringInfo ev_extra1;
	StringInfo ev_extra2;
};
typedef struct PgqTriggerEvent PgqTriggerEvent;

void pgq_prepare_event(struct PgqTriggerEvent *ev, TriggerData *tg, bool newstyle);


char *pgq_find_table_name(Relation rel);
void pgq_simple_insert(const char *queue_name, Datum ev_type, Datum ev_data, Datum ev_extra1);

struct PgqColumnInfo {
	int col_no;
	char *col_name;
};

struct PgqTableInfo {
	Oid oid;
	char *table_name;
	const char *pkey_list;
	int n_pkeys;
	int *pkey_attno;
};

struct PgqTableInfo *
pgq_find_table_info(Relation rel);


int pgqtriga_make_sql(PgqTriggerEvent *ev, TriggerData *tg, StringInfo sql);

bool pgqtriga_skip_col(PgqTriggerEvent *ev, TriggerData *tg, int i, int attkind_idx);
bool pgqtriga_is_pkey(PgqTriggerEvent *ev, TriggerData *tg, int i, int attkind_idx);



<commit_msg>pgq/triggers/common.h: cleanup and comment<commit_after>
/*
 * Per-event temporary data.
 */
struct PgqTriggerEvent {
	const char *table_name;
	const char *queue_name;
	const char *ignore_list;
	const char *pkey_list;

	const char *attkind;
	int attkind_len;

	char op_type;
	bool skip;

	struct PgqTableInfo *info;

	StringInfo ev_type;
	StringInfo ev_data;
	StringInfo ev_extra1;
	StringInfo ev_extra2;
};
typedef struct PgqTriggerEvent PgqTriggerEvent;

/*
 * Per-table cached info.
 *
 * Can be shared between triggers on same table,
 * so nothing trigger-specific should be stored.
 */
struct PgqTableInfo {
	Oid oid;
	char *table_name;
	const char *pkey_list;
	int n_pkeys;
	int *pkey_attno;
};

/* common.c */
struct PgqTableInfo *pgq_find_table_info(Relation rel);
void pgq_prepare_event(struct PgqTriggerEvent *ev, TriggerData *tg, bool newstyle);
char *pgq_find_table_name(Relation rel);
void pgq_simple_insert(const char *queue_name, Datum ev_type, Datum ev_data, Datum ev_extra1);
bool pgqtriga_skip_col(PgqTriggerEvent *ev, TriggerData *tg, int i, int attkind_idx);
bool pgqtriga_is_pkey(PgqTriggerEvent *ev, TriggerData *tg, int i, int attkind_idx);

/* makesql */
int pgqtriga_make_sql(PgqTriggerEvent *ev, TriggerData *tg, StringInfo sql);

{'fraction_non_alphanumeric': 0.08645655877342419, 'fraction_numerical': 0.002555366269165247, 'mean_word_length': 5.828488372093023, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6479751', 'n_tokens_mistral': 912, 'n_tokens_neox': 895, 'n_words': 234}