Skip to content

Commit

Permalink
basic repo structure
Browse files Browse the repository at this point in the history
  • Loading branch information
ice-ares committed Mar 25, 2024
1 parent d82da5a commit eae3da1
Show file tree
Hide file tree
Showing 8 changed files with 108 additions and 13 deletions.
34 changes: 21 additions & 13 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,21 +1,29 @@
# If you prefer the allow list template instead of the deny list, see community template:
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
#
# Binaries for programs and plugins
*.exe
*.BIN
*.exe~
*.dll
*.so
*.dylib

# Test binary, built with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Dependency directories (remove the comment below to include it)
# vendor/

# Go workspace file
*.app
*.bat
*.cgi
*.com
*.gadget
*.jar
*.pif
*.vb
*.wsf
/out
vendor/
/Godeps
*.iml
*.ipr
.idea
*.iws
/.vscode
.tmp-*
.env
*.patch
go.work
37 changes: 37 additions & 0 deletions cmd/subzero/subzero.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package main

import (
"context"
"os"
"os/signal"
"syscall"

"github.com/ice-blockchain/subzero/model"
"github.com/ice-blockchain/subzero/server"
)

func init() {
server.RegisterWSEventListener(acceptEvent)
server.RegisterWSSubscriptionListener(acceptSubscription)
}

func main() {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()

quit := make(chan os.Signal, 1)
signal.Notify(quit, syscall.SIGINT, syscall.SIGTERM)

select {
case <-ctx.Done():
case <-quit:
}
}

func acceptEvent(event *model.Event) error {
return nil
}

func acceptSubscription(subscription *model.Subscription) ([]*model.Event, error) {
return nil, nil
}
9 changes: 9 additions & 0 deletions database/command/command.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package command

import "github.com/ice-blockchain/subzero/model"

var syncQuery func(*model.Event) error

func RegisterQuerySyncer(sync func(*model.Event) error) {
syncQuery = sync
}
Empty file added database/query/DDL.sql
Empty file.
14 changes: 14 additions & 0 deletions database/query/query.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package query

import (
"github.com/ice-blockchain/subzero/database/command"
"github.com/ice-blockchain/subzero/model"
)

func init() {
command.RegisterQuerySyncer(acceptEvent)
}

func acceptEvent(event *model.Event) error {
return nil
}
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module github.com/ice-blockchain/subzero

go 1.22.0
8 changes: 8 additions & 0 deletions model/model.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package model

type (
Event struct {
}
Subscription struct {
}
)
16 changes: 16 additions & 0 deletions server/server.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package server

import (
"github.com/ice-blockchain/subzero/model"
)

var wsEventListener func(*model.Event) error
var wsSubscriptionListener func(*model.Subscription) ([]*model.Event, error)

func RegisterWSEventListener(listen func(*model.Event) error) {
wsEventListener = listen
}

func RegisterWSSubscriptionListener(listen func(*model.Subscription) ([]*model.Event, error)) {
wsSubscriptionListener = listen
}

0 comments on commit eae3da1

Please sign in to comment.