when I use sqlite display the message TypeError: window.go is undefined.
To Reproduce
create a sqlite database with table sql
CREATE TABLE Tasks (
id INTEGER PRIMARY KEY,
titulo CHAR(100) not null,
estimativa INTEGER not null default 1,
criacao DATETIME not null default NOW
);
sqlite connect
internal/database.go
package internal
import (
"context"
"fmt"
"github.com/vingarcia/ksql"
"github.com/vingarcia/ksql/adapters/ksqlite3"
)
type SQLite struct {
ksql.DB
}
func NewSQLQuery(path string) *SQLite {
db, err := ksqlite3.New(context.Background(), path, ksql.Config{
MaxOpenConns: 1,
})
if err != nil {
fmt.Println("Erro ao conectar com o banco de dados", err)
panic(err)
}
return &SQLite{
db,
}
}
create folter internal/reposioty and create file task.go
package repository
import (
"context"
"devtasks/internal"
"fmt"
"time"
"github.com/vingarcia/ksql"
)
var TasksTable = ksql.NewTable("Tasks")
type Tasks struct {
ID int `json:"id" ksql:"id"`
Titulo string `json:"titulo" ksql:"titulo"`
Estimativa int `json:"estimativa" ksql:"estimativa"`
Criacao time.Time `json:"criacao" ksql:"criacao,timeNowUTC"`
}
type PartialUpdateTask struct {
ID int `json:"id" ksql:"id"`
Titulo *string `json:"titulo" ksql:"titulo"`
Estimativa *int `json:"estimativa" ksql:"estimativa"`
}
type TasksRepository struct {
internal.SQLite
}
func NewTasksRepository(db *internal.SQLite) *TasksRepository {
return &TasksRepository{
*db,
}
}
func (t *TasksRepository) GetTasks() ([]Tasks, error) {
var tasks []Tasks
err := t.Query(context.Background(), &tasks, "FROM Tasks")
if err != nil {
return tasks, err
}
fmt.Println(tasks)
return tasks, nil
}
@devalexandre
It might because you are using a wrong port, in your snapshots, I see you are using port 5173, but actually you should try 34115 instead.
Description
when I use sqlite display the message TypeError: window.go is undefined.
To Reproduce
sqlite connect internal/database.go
create folter internal/reposioty and create file task.go
main.go
app.jsx
Expected behaviour
return a array with Tasks
Screenshots
Attempted Fixes
not fixed :(
System Details
Additional context
No response