feat(jsonrpc): init model setup

This commit is contained in:
Kristian Borgwarth 2026-03-22 00:05:26 +01:00
parent f1ee076bcb
commit e9fcd4ef8d
5 changed files with 51 additions and 0 deletions

View file

@ -10,6 +10,10 @@ import (
) )
func main() { func main() {
}
func runMigration() {
dbPath := filepath.Join("persistence", "index.db") dbPath := filepath.Join("persistence", "index.db")
db, err := sql.Open("sqlite", dbPath) db, err := sql.Open("sqlite", dbPath)

View file

View file

@ -0,0 +1,24 @@
// Package types contains relevant types for ipc
package types
import "encoding/json"
type Request struct {
Jsonrpc string `json:"jsonrpc"`
ID int `json:"id"`
Method string `json:"method"`
Params json.RawMessage `json:"params"`
}
type Response struct {
Jsonrpc string `json:"jsonrpc"`
ID int `json:"id"`
Result interface{} `json:"result,omitempty"`
Error interface{} `json:"error,omitempty"`
}
type Notification struct {
Jsonrpc string `json:"jsonrpc"`
Method string `json:"method"`
Params json.RawMessage `json:"params,omitempty"`
}

23
core/server.go Normal file
View file

@ -0,0 +1,23 @@
// Package server contains core functionality for dendrite server
package server
import (
"bufio"
"io"
"log/slog"
"os"
)
type Server struct {
in *bufio.Reader
out io.Writer
log *slog.Logger
}
func NewServer() *Server {
return &Server{
in: bufio.NewReader(os.Stdin),
out: os.Stdout,
log: slog.Default(),
}
}