Esempio n. 1
0
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 ")
}
Esempio n. 2
0
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(" ")
}
Esempio n. 3
0
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(" ")
}
Esempio n. 4
0
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(" ")
}
Esempio n. 5
0
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(" ")
}