| 65 | } |
| 66 | |
| 67 | func NewSQLiteThumbnailsTable(db *sql.DB) (tables.Thumbnails, error) { |
| 68 | s := &thumbnailStatements{} |
| 69 | _, err := db.Exec(thumbnailSchema) |
| 70 | if err != nil { |
| 71 | return nil, err |
| 72 | } |
| 73 | |
| 74 | return s, sqlutil.StatementList{ |
| 75 | {&s.insertThumbnailStmt, insertThumbnailSQL}, |
| 76 | {&s.selectThumbnailStmt, selectThumbnailSQL}, |
| 77 | {&s.selectThumbnailsStmt, selectThumbnailsSQL}, |
| 78 | }.Prepare(db) |
| 79 | } |
| 80 | |
| 81 | func (s *thumbnailStatements) InsertThumbnail(ctx context.Context, txn *sql.Tx, thumbnailMetadata *types.ThumbnailMetadata) error { |
| 82 | thumbnailMetadata.MediaMetadata.CreationTimestamp = gomatrixserverlib.AsTimestamp(time.Now()) |