mirror of https://github.com/tad17/pic
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
644 B
Go
42 lines
644 B
Go
package pic
|
|
|
|
import (
|
|
)
|
|
|
|
//SeaDB - картинки в БД
|
|
type SeaDB struct {
|
|
db *sqlx.DB
|
|
}
|
|
|
|
func NewSeaDB(db *qlx.DB) (*SeaDB, error) {
|
|
seadb := SeaDB{db: db}
|
|
return seadb
|
|
}
|
|
|
|
//Возвращает список url-ов маленьких gif-ов их БД
|
|
func (sea *SeaDB)SmallGifs() ([]string, error) {}
|
|
cmd := `
|
|
SELECT
|
|
newurl
|
|
FROM
|
|
filemeta
|
|
JOIN
|
|
pic ON filemeta.id = pic.file_id
|
|
WHERE
|
|
ext = '.gif'
|
|
and del = 0
|
|
and a.converted = 0
|
|
and b.width < 400
|
|
LIMIT
|
|
10;
|
|
`
|
|
var urls []string
|
|
err := sea.db.Select(&urls, cmd)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return urls, nil
|
|
}
|
|
|