Capture accumulated application, UI, CLI, regression tests and design documentation changes, including task project mapping and default CalDAV list naming. Keep deployment data, backups, local credentials and build artifacts out of Git. Move the Compose enrollment token to an ignored local environment file.
72 lines
1.3 KiB
Go
72 lines
1.3 KiB
Go
package store
|
|
|
|
type RevisionListItem struct {
|
|
UUID string
|
|
ObjectUUID string
|
|
DocumentHash string
|
|
Language string
|
|
ContentType string
|
|
Filename string
|
|
Message string
|
|
CreatedAt int64
|
|
CreatedAtMS int64
|
|
}
|
|
|
|
func (s *Store) ListRevisions(
|
|
objectUUID string,
|
|
) ([]RevisionListItem, error) {
|
|
|
|
rows, err := s.DB.Query(`
|
|
SELECT
|
|
uuid,
|
|
object_uuid,
|
|
COALESCE(document_hash, ''),
|
|
COALESCE(NULLIF(lang, ''), 'und'),
|
|
COALESCE(NULLIF(content_type, ''), 'text/html; charset=utf-8'),
|
|
COALESCE(filename, ''),
|
|
COALESCE(message, ''),
|
|
COALESCE(created_at, 0),
|
|
COALESCE(created_at_ms, COALESCE(created_at, 0) * 1000)
|
|
FROM revisions
|
|
WHERE object_uuid = ?
|
|
ORDER BY
|
|
COALESCE(created_at_ms, COALESCE(created_at, 0) * 1000) DESC,
|
|
rowid DESC
|
|
`,
|
|
objectUUID,
|
|
)
|
|
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
defer rows.Close()
|
|
|
|
var out []RevisionListItem
|
|
|
|
for rows.Next() {
|
|
|
|
var r RevisionListItem
|
|
|
|
err = rows.Scan(
|
|
&r.UUID,
|
|
&r.ObjectUUID,
|
|
&r.DocumentHash,
|
|
&r.Language,
|
|
&r.ContentType,
|
|
&r.Filename,
|
|
&r.Message,
|
|
&r.CreatedAt,
|
|
&r.CreatedAtMS,
|
|
)
|
|
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
out = append(out, r)
|
|
}
|
|
|
|
return out, nil
|
|
}
|