chore: go fmt
This commit is contained in:
parent
92b813c9ed
commit
4b4d3b743d
2
Makefile
2
Makefile
|
@ -12,7 +12,7 @@ endif
|
||||||
air
|
air
|
||||||
|
|
||||||
run:
|
run:
|
||||||
go run .
|
go run .
|
||||||
|
|
||||||
test:
|
test:
|
||||||
go test -cover -race ./...
|
go test -cover -race ./...
|
||||||
|
|
|
@ -10,6 +10,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/keys-pub/keys"
|
"github.com/keys-pub/keys"
|
||||||
|
|
||||||
"github.com/sour-is/ev/internal/lg"
|
"github.com/sour-is/ev/internal/lg"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@ import (
|
||||||
|
|
||||||
"github.com/keys-pub/keys"
|
"github.com/keys-pub/keys"
|
||||||
"github.com/oklog/ulid/v2"
|
"github.com/oklog/ulid/v2"
|
||||||
|
|
||||||
"github.com/sour-is/ev/pkg/es/event"
|
"github.com/sour-is/ev/pkg/es/event"
|
||||||
"github.com/sour-is/ev/pkg/gql"
|
"github.com/sour-is/ev/pkg/gql"
|
||||||
)
|
)
|
||||||
|
|
|
@ -12,13 +12,13 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/keys-pub/keys"
|
||||||
"go.mills.io/saltyim"
|
"go.mills.io/saltyim"
|
||||||
"go.opentelemetry.io/otel/metric/instrument"
|
"go.opentelemetry.io/otel/metric/instrument"
|
||||||
"go.opentelemetry.io/otel/metric/instrument/syncint64"
|
"go.opentelemetry.io/otel/metric/instrument/syncint64"
|
||||||
"go.opentelemetry.io/otel/metric/unit"
|
"go.opentelemetry.io/otel/metric/unit"
|
||||||
"go.uber.org/multierr"
|
"go.uber.org/multierr"
|
||||||
|
|
||||||
"github.com/keys-pub/keys"
|
|
||||||
"github.com/sour-is/ev/internal/lg"
|
"github.com/sour-is/ev/internal/lg"
|
||||||
"github.com/sour-is/ev/pkg/es"
|
"github.com/sour-is/ev/pkg/es"
|
||||||
"github.com/sour-is/ev/pkg/es/event"
|
"github.com/sour-is/ev/pkg/es/event"
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"log"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/rs/cors"
|
"github.com/rs/cors"
|
||||||
|
@ -18,7 +17,6 @@ func httpMux(fns ...interface{ RegisterHTTP(*http.ServeMux) }) http.Handler {
|
||||||
fn.RegisterHTTP(mux.ServeMux)
|
fn.RegisterHTTP(mux.ServeMux)
|
||||||
|
|
||||||
if fn, ok := fn.(interface{ RegisterAPIv1(*http.ServeMux) }); ok {
|
if fn, ok := fn.(interface{ RegisterAPIv1(*http.ServeMux) }); ok {
|
||||||
log.Printf("register api %T", fn)
|
|
||||||
fn.RegisterAPIv1(mux.api)
|
fn.RegisterAPIv1(mux.api)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,6 +34,7 @@ func newMux() *mux {
|
||||||
}
|
}
|
||||||
|
|
||||||
type RegisterHTTP func(*http.ServeMux)
|
type RegisterHTTP func(*http.ServeMux)
|
||||||
|
|
||||||
func (fn RegisterHTTP) RegisterHTTP(mux *http.ServeMux) {
|
func (fn RegisterHTTP) RegisterHTTP(mux *http.ServeMux) {
|
||||||
fn(mux)
|
fn(mux)
|
||||||
}
|
}
|
||||||
|
|
|
@ -188,7 +188,6 @@ func (e *eventLog) Append(ctx context.Context, events event.Events, version uint
|
||||||
attribute.Int64("args.version", int64(version)),
|
attribute.Int64("args.version", int64(version)),
|
||||||
attribute.String("streamID", e.streamID),
|
attribute.String("streamID", e.streamID),
|
||||||
attribute.String("path", e.diskStore.path),
|
attribute.String("path", e.diskStore.path),
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
event.SetStreamID(e.streamID, events...)
|
event.SetStreamID(e.streamID, events...)
|
||||||
|
@ -279,7 +278,6 @@ func (e *eventLog) Read(ctx context.Context, after, count int64) (event.Events,
|
||||||
attribute.Int64("start", int64(start)),
|
attribute.Int64("start", int64(start)),
|
||||||
attribute.Int64("count", int64(count)),
|
attribute.Int64("count", int64(count)),
|
||||||
attribute.Int64("after", int64(after)),
|
attribute.Int64("after", int64(after)),
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
events = make([]event.Event, math.Abs(count))
|
events = make([]event.Event, math.Abs(count))
|
||||||
|
@ -322,7 +320,7 @@ func (e *eventLog) ReadN(ctx context.Context, index ...uint64) (event.Events, er
|
||||||
|
|
||||||
lis := make([]int64, len(index))
|
lis := make([]int64, len(index))
|
||||||
for i := range index {
|
for i := range index {
|
||||||
lis[i]=int64(index[i])
|
lis[i] = int64(index[i])
|
||||||
}
|
}
|
||||||
|
|
||||||
span.SetAttributes(
|
span.SetAttributes(
|
||||||
|
@ -345,7 +343,7 @@ func (e *eventLog) ReadN(ctx context.Context, index ...uint64) (event.Events, er
|
||||||
func (e *eventLog) FirstIndex(ctx context.Context) (uint64, error) {
|
func (e *eventLog) FirstIndex(ctx context.Context) (uint64, error) {
|
||||||
ctx, span := lg.Span(ctx)
|
ctx, span := lg.Span(ctx)
|
||||||
defer span.End()
|
defer span.End()
|
||||||
|
|
||||||
span.SetAttributes(
|
span.SetAttributes(
|
||||||
attribute.String("streamID", e.streamID),
|
attribute.String("streamID", e.streamID),
|
||||||
attribute.String("path", e.diskStore.path),
|
attribute.String("path", e.diskStore.path),
|
||||||
|
@ -383,7 +381,7 @@ func (e *eventLog) LastIndex(ctx context.Context) (uint64, error) {
|
||||||
func (e *eventLog) Truncate(ctx context.Context, index int64) error {
|
func (e *eventLog) Truncate(ctx context.Context, index int64) error {
|
||||||
ctx, span := lg.Span(ctx)
|
ctx, span := lg.Span(ctx)
|
||||||
defer span.End()
|
defer span.End()
|
||||||
|
|
||||||
span.SetAttributes(
|
span.SetAttributes(
|
||||||
attribute.Int64("args.index", index),
|
attribute.Int64("args.index", index),
|
||||||
attribute.String("streamID", e.streamID),
|
attribute.String("streamID", e.streamID),
|
||||||
|
@ -432,7 +430,7 @@ func readStreamN(ctx context.Context, stream *wal.Log, index ...uint64) (event.E
|
||||||
|
|
||||||
lis := make([]int64, len(index))
|
lis := make([]int64, len(index))
|
||||||
for i := range index {
|
for i := range index {
|
||||||
lis[i]=int64(index[i])
|
lis[i] = int64(index[i])
|
||||||
}
|
}
|
||||||
|
|
||||||
span.SetAttributes(
|
span.SetAttributes(
|
||||||
|
|
|
@ -118,7 +118,6 @@ func (w *wrapper) LastIndex(ctx context.Context) (uint64, error) {
|
||||||
return w.up.LastIndex(ctx)
|
return w.up.LastIndex(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func DefaultProjection(e event.Event) []event.Event {
|
func DefaultProjection(e event.Event) []event.Event {
|
||||||
m := e.EventMeta()
|
m := e.EventMeta()
|
||||||
streamID := m.StreamID
|
streamID := m.StreamID
|
||||||
|
|
|
@ -274,7 +274,7 @@ func (es *EventStore) EventStream() driver.EventStream {
|
||||||
func (es *EventStore) Truncate(ctx context.Context, streamID string, index int64) error {
|
func (es *EventStore) Truncate(ctx context.Context, streamID string, index int64) error {
|
||||||
ctx, span := lg.Span(ctx)
|
ctx, span := lg.Span(ctx)
|
||||||
defer span.End()
|
defer span.End()
|
||||||
|
|
||||||
up, err := es.Driver.EventLog(ctx, streamID)
|
up, err := es.Driver.EventLog(ctx, streamID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
@ -124,7 +124,7 @@ func GetContainer(ctx context.Context, s string) Event {
|
||||||
|
|
||||||
var e Event
|
var e Event
|
||||||
|
|
||||||
eventTypes.Modify(ctx, func(ctx context.Context,c *config) error {
|
eventTypes.Modify(ctx, func(ctx context.Context, c *config) error {
|
||||||
_, span := lg.Span(ctx)
|
_, span := lg.Span(ctx)
|
||||||
defer span.End()
|
defer span.End()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user