generated from alecodes/base-template
wip: implementing db initialization
This commit is contained in:
parent
ffd3c2014e
commit
d4857c48cf
10 changed files with 383 additions and 0 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -16,3 +16,4 @@ pip-selfcheck.json
|
||||||
secring.*
|
secring.*
|
||||||
|
|
||||||
|
|
||||||
|
**/*.sql
|
||||||
|
|
|
||||||
2
.justfile
Normal file
2
.justfile
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
run:
|
||||||
|
go run examples/usage.go
|
||||||
2
.mise.toml
Normal file
2
.mise.toml
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
[tools]
|
||||||
|
go = "latest"
|
||||||
53
examples/usage.go
Normal file
53
examples/usage.go
Normal file
|
|
@ -0,0 +1,53 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"database/sql"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
synchronizator "git.alecodes.page/alecodes/synchronizator/pkg"
|
||||||
|
_ "modernc.org/sqlite"
|
||||||
|
)
|
||||||
|
|
||||||
|
type ProgrammingLanguage struct {
|
||||||
|
Name string
|
||||||
|
}
|
||||||
|
|
||||||
|
type Library struct {
|
||||||
|
Version string `json:"version"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type BelognsTo struct{}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
connection, err := sql.Open("sqlite", "db.sql")
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
defer connection.Close()
|
||||||
|
|
||||||
|
opts := synchronizator.DefaultOptions
|
||||||
|
opts.Log_level = synchronizator.DEBUG
|
||||||
|
opts.DANGEROUSLY_DROP_TABLES = true
|
||||||
|
|
||||||
|
sync, err := synchronizator.New(connection, opts)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
sync.RegisterNodeClass(Library{})
|
||||||
|
|
||||||
|
// collection, err := sync.NewCollection(ProgrammingLanguage{Name: "foo"})
|
||||||
|
node, err := sync.NewNode("React", Library{Version: "v22"})
|
||||||
|
// node, err := sync.GetNode(1)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// fmt.Printf("\n%+v\n", collection)
|
||||||
|
fmt.Printf("\n%+v\n", node)
|
||||||
|
}
|
||||||
21
go.mod
Normal file
21
go.mod
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
module git.alecodes.page/alecodes/synchronizator
|
||||||
|
|
||||||
|
go 1.23.2
|
||||||
|
|
||||||
|
require modernc.org/sqlite v1.33.1
|
||||||
|
|
||||||
|
require (
|
||||||
|
github.com/dustin/go-humanize v1.0.1 // indirect
|
||||||
|
github.com/google/uuid v1.6.0 // indirect
|
||||||
|
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
|
||||||
|
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||||
|
github.com/ncruces/go-strftime v0.1.9 // indirect
|
||||||
|
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
|
||||||
|
golang.org/x/sys v0.22.0 // indirect
|
||||||
|
modernc.org/gc/v3 v3.0.0-20240107210532-573471604cb6 // indirect
|
||||||
|
modernc.org/libc v1.55.3 // indirect
|
||||||
|
modernc.org/mathutil v1.6.0 // indirect
|
||||||
|
modernc.org/memory v1.8.0 // indirect
|
||||||
|
modernc.org/strutil v1.2.0 // indirect
|
||||||
|
modernc.org/token v1.1.0 // indirect
|
||||||
|
)
|
||||||
49
go.sum
Normal file
49
go.sum
Normal file
|
|
@ -0,0 +1,49 @@
|
||||||
|
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
|
||||||
|
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
|
||||||
|
github.com/google/pprof v0.0.0-20240409012703-83162a5b38cd h1:gbpYu9NMq8jhDVbvlGkMFWCjLFlqqEZjEmObmhUy6Vo=
|
||||||
|
github.com/google/pprof v0.0.0-20240409012703-83162a5b38cd/go.mod h1:kf6iHlnVGwgKolg33glAes7Yg/8iWP8ukqeldJSO7jw=
|
||||||
|
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||||
|
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
|
github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k=
|
||||||
|
github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM=
|
||||||
|
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
||||||
|
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||||
|
github.com/ncruces/go-strftime v0.1.9 h1:bY0MQC28UADQmHmaF5dgpLmImcShSi2kHU9XLdhx/f4=
|
||||||
|
github.com/ncruces/go-strftime v0.1.9/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls=
|
||||||
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
|
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE=
|
||||||
|
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
|
||||||
|
golang.org/x/mod v0.16.0 h1:QX4fJ0Rr5cPQCF7O9lh9Se4pmwfwskqZfq5moyldzic=
|
||||||
|
golang.org/x/mod v0.16.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
|
||||||
|
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI=
|
||||||
|
golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||||
|
golang.org/x/tools v0.19.0 h1:tfGCXNR1OsFG+sVdLAitlpjAvD/I6dHDKnYrpEZUHkw=
|
||||||
|
golang.org/x/tools v0.19.0/go.mod h1:qoJWxmGSIBmAeriMx19ogtrEPrGtDbPK634QFIcLAhc=
|
||||||
|
modernc.org/cc/v4 v4.21.4 h1:3Be/Rdo1fpr8GrQ7IVw9OHtplU4gWbb+wNgeoBMmGLQ=
|
||||||
|
modernc.org/cc/v4 v4.21.4/go.mod h1:HM7VJTZbUCR3rV8EYBi9wxnJ0ZBRiGE5OeGXNA0IsLQ=
|
||||||
|
modernc.org/ccgo/v4 v4.19.2 h1:lwQZgvboKD0jBwdaeVCTouxhxAyN6iawF3STraAal8Y=
|
||||||
|
modernc.org/ccgo/v4 v4.19.2/go.mod h1:ysS3mxiMV38XGRTTcgo0DQTeTmAO4oCmJl1nX9VFI3s=
|
||||||
|
modernc.org/fileutil v1.3.0 h1:gQ5SIzK3H9kdfai/5x41oQiKValumqNTDXMvKo62HvE=
|
||||||
|
modernc.org/fileutil v1.3.0/go.mod h1:XatxS8fZi3pS8/hKG2GH/ArUogfxjpEKs3Ku3aK4JyQ=
|
||||||
|
modernc.org/gc/v2 v2.4.1 h1:9cNzOqPyMJBvrUipmynX0ZohMhcxPtMccYgGOJdOiBw=
|
||||||
|
modernc.org/gc/v2 v2.4.1/go.mod h1:wzN5dK1AzVGoH6XOzc3YZ+ey/jPgYHLuVckd62P0GYU=
|
||||||
|
modernc.org/gc/v3 v3.0.0-20240107210532-573471604cb6 h1:5D53IMaUuA5InSeMu9eJtlQXS2NxAhyWQvkKEgXZhHI=
|
||||||
|
modernc.org/gc/v3 v3.0.0-20240107210532-573471604cb6/go.mod h1:Qz0X07sNOR1jWYCrJMEnbW/X55x206Q7Vt4mz6/wHp4=
|
||||||
|
modernc.org/libc v1.55.3 h1:AzcW1mhlPNrRtjS5sS+eW2ISCgSOLLNyFzRh/V3Qj/U=
|
||||||
|
modernc.org/libc v1.55.3/go.mod h1:qFXepLhz+JjFThQ4kzwzOjA/y/artDeg+pcYnY+Q83w=
|
||||||
|
modernc.org/mathutil v1.6.0 h1:fRe9+AmYlaej+64JsEEhoWuAYBkOtQiMEU7n/XgfYi4=
|
||||||
|
modernc.org/mathutil v1.6.0/go.mod h1:Ui5Q9q1TR2gFm0AQRqQUaBWFLAhQpCwNcuhBOSedWPo=
|
||||||
|
modernc.org/memory v1.8.0 h1:IqGTL6eFMaDZZhEWwcREgeMXYwmW83LYW8cROZYkg+E=
|
||||||
|
modernc.org/memory v1.8.0/go.mod h1:XPZ936zp5OMKGWPqbD3JShgd/ZoQ7899TUuQqxY+peU=
|
||||||
|
modernc.org/opt v0.1.3 h1:3XOZf2yznlhC+ibLltsDGzABUGVx8J6pnFMS3E4dcq4=
|
||||||
|
modernc.org/opt v0.1.3/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0=
|
||||||
|
modernc.org/sortutil v1.2.0 h1:jQiD3PfS2REGJNzNCMMaLSp/wdMNieTbKX920Cqdgqc=
|
||||||
|
modernc.org/sortutil v1.2.0/go.mod h1:TKU2s7kJMf1AE84OoiGppNHJwvB753OYfNl2WRb++Ss=
|
||||||
|
modernc.org/sqlite v1.33.1 h1:trb6Z3YYoeM9eDL1O8do81kP+0ejv+YzgyFo+Gwy0nM=
|
||||||
|
modernc.org/sqlite v1.33.1/go.mod h1:pXV2xHxhzXZsgT/RtTFAPY6JJDEvOTcTdwADQCCWD4k=
|
||||||
|
modernc.org/strutil v1.2.0 h1:agBi9dp1I+eOnxXeiZawM8F4LawKv4NzGWSaLfyeNZA=
|
||||||
|
modernc.org/strutil v1.2.0/go.mod h1:/mdcBmfOibveCTBxUl5B5l6W+TTH1FXPLHZE6bTosX0=
|
||||||
|
modernc.org/token v1.1.0 h1:Xl7Ap9dKaEs5kLoOQeQmPWevfnk/DM5qcLcYlA8ys6Y=
|
||||||
|
modernc.org/token v1.1.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM=
|
||||||
25
pkg/loglevel_string.go
Normal file
25
pkg/loglevel_string.go
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
// Code generated by "stringer -type=LogLevel"; DO NOT EDIT.
|
||||||
|
|
||||||
|
package synchronizator
|
||||||
|
|
||||||
|
import "strconv"
|
||||||
|
|
||||||
|
func _() {
|
||||||
|
// An "invalid array index" compiler error signifies that the constant values have changed.
|
||||||
|
// Re-run the stringer command to generate them again.
|
||||||
|
var x [1]struct{}
|
||||||
|
_ = x[ERROR-0]
|
||||||
|
_ = x[INFO-1]
|
||||||
|
_ = x[DEBUG-2]
|
||||||
|
}
|
||||||
|
|
||||||
|
const _LogLevel_name = "ERRORINFODEBUG"
|
||||||
|
|
||||||
|
var _LogLevel_index = [...]uint8{0, 5, 9, 14}
|
||||||
|
|
||||||
|
func (i LogLevel) String() string {
|
||||||
|
if i < 0 || i >= LogLevel(len(_LogLevel_index)-1) {
|
||||||
|
return "LogLevel(" + strconv.FormatInt(int64(i), 10) + ")"
|
||||||
|
}
|
||||||
|
return _LogLevel_name[_LogLevel_index[i]:_LogLevel_index[i+1]]
|
||||||
|
}
|
||||||
9
pkg/node.go
Normal file
9
pkg/node.go
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
package synchronizator
|
||||||
|
|
||||||
|
type Node struct {
|
||||||
|
_id int64
|
||||||
|
_class string
|
||||||
|
_relationships []*Relationship
|
||||||
|
name string
|
||||||
|
metadata any
|
||||||
|
}
|
||||||
184
pkg/synchronizator.go
Normal file
184
pkg/synchronizator.go
Normal file
|
|
@ -0,0 +1,184 @@
|
||||||
|
package synchronizator
|
||||||
|
|
||||||
|
import (
|
||||||
|
sql "database/sql"
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
"reflect"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
var DefaultOptions = &Options{
|
||||||
|
Logger: os.Stdout,
|
||||||
|
Log_level: INFO,
|
||||||
|
DANGEROUSLY_DROP_TABLES: false,
|
||||||
|
}
|
||||||
|
|
||||||
|
func New(connection *sql.DB, options *Options) (*db, error) {
|
||||||
|
if options == nil {
|
||||||
|
options = DefaultOptions
|
||||||
|
}
|
||||||
|
|
||||||
|
conn := db{
|
||||||
|
Connection: connection,
|
||||||
|
logger: options.Logger,
|
||||||
|
log_level: options.Log_level,
|
||||||
|
drop_tables: options.DANGEROUSLY_DROP_TABLES,
|
||||||
|
}
|
||||||
|
|
||||||
|
err := conn.bootstrap()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return &conn, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (conn *db) log(level LogLevel, args ...any) {
|
||||||
|
// Only log if the level is the same or lower than the configured
|
||||||
|
if level > conn.log_level {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Fprintf(conn.logger, "[ %s - %-5s ]: ", time.Now().Format(time.DateTime), level.String())
|
||||||
|
fmt.Fprintln(conn.logger, args...)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (conn *db) bootstrap() error {
|
||||||
|
conn.log(INFO, "Initializing database...")
|
||||||
|
|
||||||
|
sql := ""
|
||||||
|
|
||||||
|
if conn.drop_tables {
|
||||||
|
sql += `
|
||||||
|
DROP TABLE IF EXISTS nodes;
|
||||||
|
DROP TABLE IF EXISTS relationships;
|
||||||
|
DROP INDEX IF EXISTS node_class;
|
||||||
|
DROP INDEX IF EXISTS relationships_class;
|
||||||
|
`
|
||||||
|
}
|
||||||
|
|
||||||
|
sql += `
|
||||||
|
CREATE TABLE IF NOT EXISTS nodes (
|
||||||
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
|
_class text NOT NULL,
|
||||||
|
name TEXT,
|
||||||
|
metadata jsonb DEFAULT '{}'
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE INDEX IF NOT EXISTS node_class on nodes (_class);
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS relationships (
|
||||||
|
node_from INTEGER NOT NULL,
|
||||||
|
node_to INTEGER NOT NULL,
|
||||||
|
_class text NOT NULL,
|
||||||
|
PRIMARY KEY (node_from, node_to),
|
||||||
|
CHECK (node_from != node_to),
|
||||||
|
CONSTRAINT fk_node_from_relationships FOREIGN KEY (node_from) REFERENCES nodes(id),
|
||||||
|
CONSTRAINT fk_node_to_relationships FOREIGN KEY (node_to) REFERENCES nodes(id)
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE INDEX IF NOT EXISTS relationships_class on relationships (_class);
|
||||||
|
`
|
||||||
|
|
||||||
|
conn.log(DEBUG, sql)
|
||||||
|
_, err := conn.Connection.Exec(sql)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (conn *db) generateNodeFromStruct(shape any) *Node {
|
||||||
|
// Get the type and handle pointer types
|
||||||
|
t := reflect.TypeOf(shape)
|
||||||
|
if t.Kind() == reflect.Ptr {
|
||||||
|
t = t.Elem()
|
||||||
|
}
|
||||||
|
|
||||||
|
node := Node{
|
||||||
|
_id: -1,
|
||||||
|
_class: strings.ToUpper(t.Name()),
|
||||||
|
metadata: shape,
|
||||||
|
}
|
||||||
|
return &node
|
||||||
|
}
|
||||||
|
|
||||||
|
func (conn *db) RegisterNodeClass(shape any) {
|
||||||
|
if conn.node_types == nil {
|
||||||
|
conn.node_types = make(NodeType)
|
||||||
|
}
|
||||||
|
|
||||||
|
node := conn.generateNodeFromStruct(shape)
|
||||||
|
|
||||||
|
conn.node_types[node._class] = *node
|
||||||
|
|
||||||
|
conn.log(DEBUG, "Registered node class: ", node)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (conn *db) NewCollection(shape any) (*Node, error) {
|
||||||
|
collection, err := conn.NewNode("collection", shape)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return collection, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (conn *db) NewNode(name string, metadata any) (*Node, error) {
|
||||||
|
if metadata == nil {
|
||||||
|
return nil, fmt.Errorf("metadata cannot be nil")
|
||||||
|
}
|
||||||
|
|
||||||
|
json_metadata, err := json.Marshal(metadata)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("invalid metadata format: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
node := conn.generateNodeFromStruct(metadata)
|
||||||
|
node.name = name
|
||||||
|
|
||||||
|
tx, err := conn.Connection.Begin()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
defer tx.Rollback()
|
||||||
|
|
||||||
|
conn.log(DEBUG, "Creating node:", node)
|
||||||
|
|
||||||
|
sql := "INSERT INTO nodes (_class, name, metadata) VALUES ($1, $2, $3) RETURNING id;"
|
||||||
|
|
||||||
|
err = tx.QueryRow(sql, node._class, node.name, json_metadata).Scan(&node._id)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := tx.Commit(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return node, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (conn *db) GetNode(id int64) (*Node, error) {
|
||||||
|
node := Node{_id: id}
|
||||||
|
sql := "SELECT _class, metadata FROM nodes WHERE id = $1;"
|
||||||
|
conn.log(DEBUG, sql)
|
||||||
|
|
||||||
|
var metadata []byte
|
||||||
|
err := conn.Connection.QueryRow(sql, id).Scan(&node._class, &metadata)
|
||||||
|
if err != nil {
|
||||||
|
conn.log(DEBUG, err)
|
||||||
|
return nil, fmt.Errorf("No row matching id = %v", id)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := json.Unmarshal(metadata, &node.metadata); err != nil {
|
||||||
|
conn.log(ERROR, err)
|
||||||
|
return nil, fmt.Errorf("invalid metadata format: %w", err)
|
||||||
|
}
|
||||||
|
return &node, nil
|
||||||
|
}
|
||||||
37
pkg/types.go
Normal file
37
pkg/types.go
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
package synchronizator
|
||||||
|
|
||||||
|
import (
|
||||||
|
sql "database/sql"
|
||||||
|
"os"
|
||||||
|
)
|
||||||
|
|
||||||
|
type NodeType map[string]Node
|
||||||
|
|
||||||
|
type db struct {
|
||||||
|
Connection *sql.DB
|
||||||
|
logger *os.File
|
||||||
|
log_level LogLevel
|
||||||
|
drop_tables bool
|
||||||
|
node_types NodeType
|
||||||
|
}
|
||||||
|
|
||||||
|
type Options struct {
|
||||||
|
Logger *os.File
|
||||||
|
Log_level LogLevel
|
||||||
|
DANGEROUSLY_DROP_TABLES bool
|
||||||
|
}
|
||||||
|
|
||||||
|
type Relationship struct {
|
||||||
|
_class string
|
||||||
|
}
|
||||||
|
|
||||||
|
type LogLevel int
|
||||||
|
|
||||||
|
// Lower levels take precedence
|
||||||
|
|
||||||
|
//go:generate stringer -type=LogLevel
|
||||||
|
const (
|
||||||
|
ERROR LogLevel = iota
|
||||||
|
INFO
|
||||||
|
DEBUG
|
||||||
|
)
|
||||||
Reference in a new issue