package msgstore import ( lib "git.sr.ht/~cco/go-scopes" "git.sr.ht/~cco/go-scopes/storage/sql" ) var Store = func(db *sql.Storage, msg lib.Message) { q := buildQuery(db, "insert_msg", "messages") db.Exec(q, msg.Domain(), msg.Action(), msg.Class(), msg.Item(), msg.Payload()) } func buildQuery(db *sql.Storage, qname, tname string) string { t := db.Sql.Lookup(qname) return db.SetTable(t, tname) }