func getItemFromCollectionSQL(slug, tag string) *pan.Query { query := pan.New(pan.MYSQL, "SELECT tag, collection, sha, bucket FROM "+itemTable) query.IncludeWhere() query.Include("collection=?", slug) query.Include("tag=?", tag) return query.FlushExpressions(" AND ") }
func addItemToCollectionSQL(slug string, item Item) *pan.Query { query := pan.New(pan.MYSQL, "INSERT INTO "+itemTable+" (tag, collection, sha, bucket)") query.Include("VALUES (?,?,?,?)", item.Tag, slug, item.Blob, item.Bucket) return query.FlushExpressions(" ") }
func createItemTableSQL() *pan.Query { query := pan.New(pan.MYSQL, "CREATE TABLE IF NOT EXISTS "+itemTable) query.Include("(tag VARCHAR(32), collection VARCHAR(32), sha VARCHAR(64), bucket VARCHAR(64))") return query.FlushExpressions(" ") }
func createCollectionSQL(slug, name string) *pan.Query { query := pan.New(pan.MYSQL, "INSERT INTO "+collectionTable+" (slug, name)") query.Include("VALUES (?,?)", slug, name) return query.FlushExpressions(" ") }
func createCollectionTableSQL() *pan.Query { query := pan.New(pan.MYSQL, "CREATE TABLE IF NOT EXISTS "+collectionTable) query.Include("(slug VARCHAR(32), name VARCHAR(64))") return query.FlushExpressions(" ") }