aboutsummaryrefslogtreecommitdiffstats
path: root/pkg
diff options
context:
space:
mode:
Diffstat (limited to 'pkg')
-rw-r--r--pkg/data/get.go23
-rw-r--r--pkg/data/put.go2
-rw-r--r--pkg/index/filters.go2
-rw-r--r--pkg/index/index.go1
-rw-r--r--pkg/query/compiler.go2
-rw-r--r--pkg/query/outputs.go2
-rw-r--r--pkg/query/parser.go1
7 files changed, 17 insertions, 16 deletions
diff --git a/pkg/data/get.go b/pkg/data/get.go
index 840ca53..396f132 100644
--- a/pkg/data/get.go
+++ b/pkg/data/get.go
@@ -3,13 +3,12 @@ package data
import (
"context"
"database/sql"
+ "fmt"
"time"
"github.com/jpappel/atlas/pkg/index"
)
-// TODO: rename struct
-//
// Use to build a document from a database connection
type Fill struct {
Path string
@@ -18,8 +17,6 @@ type Fill struct {
doc *index.Document
}
-// TODO: rename struct
-//
// Use to build documents and aliases from a database connection
type FillMany struct {
docs map[string]*index.Document
@@ -108,8 +105,22 @@ func (f *FillMany) documents(ctx context.Context, rows *sql.Rows) error {
return err
}
defer rows.Close()
- } else {
- // TODO: check if rows.ColumnTypes() matches expected
+ } else if cols, err := rows.ColumnTypes(); err != nil {
+ return err
+ } else if len(cols) != 6 {
+ return fmt.Errorf("Not enough columns to fill documents with")
+ } else if t := cols[0].DatabaseTypeName(); t != "INTEGER" {
+ return fmt.Errorf("Expected integer for id column fill, got %s", t)
+ } else if t := cols[1].DatabaseTypeName(); t != "TEXT" {
+ return fmt.Errorf("Expected text for path column fill, got %s", t)
+ } else if t := cols[2].DatabaseTypeName(); t != "TEXT" {
+ return fmt.Errorf("Expected text for title column fill, got %s", t)
+ } else if t := cols[3].DatabaseTypeName(); t != "INT" {
+ return fmt.Errorf("Expected integer for date column fill, got %s", t)
+ } else if t := cols[4].DatabaseTypeName(); t != "INT" {
+ return fmt.Errorf("Expected integer for filetime column fill, got %s", t)
+ } else if t := cols[5].DatabaseTypeName(); t != "BLOB" {
+ return fmt.Errorf("Expected text for meta column fill, got %s", t)
}
var id int
diff --git a/pkg/data/put.go b/pkg/data/put.go
index 6631eb0..6ceccc3 100644
--- a/pkg/data/put.go
+++ b/pkg/data/put.go
@@ -9,7 +9,6 @@ import (
"github.com/jpappel/atlas/pkg/index"
)
-// TODO: rename struct
type Put struct {
Id int64
Doc index.Document
@@ -17,7 +16,6 @@ type Put struct {
db *sql.DB
}
-// TODO: rename struct
type PutMany struct {
Docs map[int64]*index.Document
pathDocs map[string]*index.Document
diff --git a/pkg/index/filters.go b/pkg/index/filters.go
index bd9df54..3deee6d 100644
--- a/pkg/index/filters.go
+++ b/pkg/index/filters.go
@@ -11,8 +11,6 @@ import (
"strings"
)
-// TODO: add support for lua filters
-
type DocFilter struct {
Name string
Filter func(InfoPath, io.ReadSeeker) bool
diff --git a/pkg/index/index.go b/pkg/index/index.go
index f4e4593..b354bbf 100644
--- a/pkg/index/index.go
+++ b/pkg/index/index.go
@@ -213,7 +213,6 @@ func (doc Document) Equal(other Document) bool {
}
func visit(file InfoPath, visitQueue chan<- InfoPath, filterQueue chan<- InfoPath, ignoreHidden bool, wg *sync.WaitGroup) {
- // TODO: check if symlink, and handle appropriately
// TODO: extract error out of function
if ignoreHidden && path.Base(file.Path)[0] == '.' {
diff --git a/pkg/query/compiler.go b/pkg/query/compiler.go
index 0637fea..8b71124 100644
--- a/pkg/query/compiler.go
+++ b/pkg/query/compiler.go
@@ -34,8 +34,6 @@ func (s Statements) buildCompile(b *strings.Builder, delim string) ([]any, error
sCount := 0
for cat, catStmts := range s.CategoryPartition() {
- // TODO: make sure sorted
- // TODO: loop over partitions
if len(catStmts) == 0 {
continue
}
diff --git a/pkg/query/outputs.go b/pkg/query/outputs.go
index d1e70e8..e3555c1 100644
--- a/pkg/query/outputs.go
+++ b/pkg/query/outputs.go
@@ -15,7 +15,6 @@ const DefaultOutputFormat string = "%p %T %d authors:%a tags:%t"
type OutputToken uint64
-// TODO: support long token names
const (
OUT_TOK_STR OutputToken = iota
OUT_TOK_PATH // %p %path
@@ -28,7 +27,6 @@ const (
OUT_TOK_META // %m %meta
)
-// TODO: change interface to use byte slices
type Outputer interface {
OutputOne(doc *index.Document) (string, error)
OutputOneTo(w io.Writer, doc *index.Document) (int, error)
diff --git a/pkg/query/parser.go b/pkg/query/parser.go
index ce4ee7b..5ff8175 100644
--- a/pkg/query/parser.go
+++ b/pkg/query/parser.go
@@ -70,7 +70,6 @@ const (
VAL_DATETIME
)
-// TODO: rename
type Valuer interface {
Type() valuerType
Compare(Valuer) int