diff --git a/core/env/provider.go b/core/env/provider.go index 969771b4..a264428f 100644 --- a/core/env/provider.go +++ b/core/env/provider.go @@ -91,6 +91,10 @@ type StoreProvider interface { // QueryTableList returns a list tables in Documize database. QueryTableList() string + // QueryDateInterval returns provider specific + // interval style date SQL. + QueryDateInterval(days int64) string + // JSONEmpty returns empty SQL JSON object. // Typically used as 2nd parameter to COALESCE(). JSONEmpty() string diff --git a/domain/document/export.go b/domain/document/export.go index 890b9894..f1a06e4a 100644 --- a/domain/document/export.go +++ b/domain/document/export.go @@ -52,6 +52,8 @@ func BuildExport(ctx domain.RequestContext, s store.Store, spec exportSpec) (htm if e == nil { content.WriteString(c) toc = append(toc, t...) + } else { + fmt.Println("export.space", err) } } @@ -60,6 +62,8 @@ func BuildExport(ctx domain.RequestContext, s store.Store, spec exportSpec) (htm if e == nil { content.WriteString(c) toc = append(toc, t...) + } else { + fmt.Println("export.category", err) } case "document": @@ -67,6 +71,8 @@ func BuildExport(ctx domain.RequestContext, s store.Store, spec exportSpec) (htm if e == nil { content.WriteString(c) toc = append(toc, t...) + } else { + fmt.Println("export.document", err) } } diff --git a/edition/storage/mysql.go b/edition/storage/mysql.go index d82e58db..cb6a14bf 100644 --- a/edition/storage/mysql.go +++ b/edition/storage/mysql.go @@ -298,6 +298,12 @@ func (p MySQLProvider) QueryTableList() string { WHERE TABLE_SCHEMA = '` + p.DatabaseName() + `' AND TABLE_TYPE='BASE TABLE'` } +// QueryDateInterval returns provider specific interval style +// date SQL. +func (p MySQLProvider) QueryDateInterval(days int64) string { + return fmt.Sprintf("DATE(NOW()) - INTERVAL %d DAY", days) +} + // JSONEmpty returns empty SQL JSON object. // Typically used as 2nd parameter to COALESCE(). func (p MySQLProvider) JSONEmpty() string { diff --git a/edition/storage/postgresql.go b/edition/storage/postgresql.go index 14f318f6..0eef459d 100644 --- a/edition/storage/postgresql.go +++ b/edition/storage/postgresql.go @@ -263,6 +263,12 @@ func (p PostgreSQLProvider) QueryTableList() string { WHERE table_type='BASE TABLE' AND table_schema NOT IN ('pg_catalog', 'information_schema') AND table_catalog='%s'`, p.DatabaseName()) } +// QueryDateInterval returns provider specific interval style +// date SQL. +func (p PostgreSQLProvider) QueryDateInterval(days int64) string { + return fmt.Sprintf("DATE(NOW()) - INTERVAL '%d day'", days) +} + // JSONEmpty returns empty SQL JSON object. // Typically used as 2nd parameter to COALESCE(). func (p PostgreSQLProvider) JSONEmpty() string {