Skip to content

Commit

Permalink
feat: support sqlite view
Browse files Browse the repository at this point in the history
  • Loading branch information
shellfly committed Apr 20, 2023
1 parent 34ee97a commit 78095c7
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions pkg/log/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ var (
func init() { //nolint:gochecknoinits
level := os.Getenv("REST_LOG_LEVEL")
switch strings.ToLower(level) {
case "trace":
logLevel = TraceLevel
case "error":
logLevel = ErrorLevel
case "warn":
Expand Down
2 changes: 1 addition & 1 deletion pkg/sql/helper_my.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ func (h MyHelper) GetTablesSQL() string {
return `
SELECT TABLE_NAME as name
FROM information_schema.TABLES
WHERE TABLE_TYPE LIKE 'BASE_TABLE' AND TABLE_SCHEMA=DATABASE();
WHERE (TABLE_TYPE = 'BASE_TABLE' OR TABLE_TYPE = 'view') AND TABLE_SCHEMA=DATABASE();
`
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/sql/helper_sqlite.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ func (h SQLiteHelper) GetTablesSQL() string {
FROM
sqlite_schema
WHERE
type ='table' AND
(type ='table' OR type = 'view') AND
name NOT LIKE 'sqlite_%';
`
}
Expand Down
1 change: 1 addition & 0 deletions pkg/sql/urlquery.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ var (
// date functions
"date", "date_format", "date_part", "date_trunc", "extract", "hour",
"minute", "month", "second", "utctimestamp", "weekofday", "year",
"time", "datetime", "julianday", "unixepoch", "strftime",
// string functions
"bit_length", "chr", "char_length", "left", "length", "ord", "trim",
}
Expand Down

0 comments on commit 78095c7

Please sign in to comment.