Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/jessevdk/go-flags"
_ "github.com/lib/pq"
_ "github.com/mattn/go-sqlite3"
"github.com/relops/sqlc/sqlc"
"github.com/shutej/sqlc/sqlc"
"log"
"os"
)
Expand Down
27 changes: 25 additions & 2 deletions meta/types.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,36 @@
package meta

import (
"reflect"
)

type TypeInfo struct {
Prefix string
Literal string
Type reflect.Type
}

var Types = []TypeInfo{
TypeInfo{Prefix: "String", Literal: "string"},
TypeInfo{Prefix: "Bool", Literal: "bool"},
TypeInfo{Prefix: "Date", Literal: "time.Time"}, // TODO(shutej): test
TypeInfo{Prefix: "Datetime", Literal: "time.Time"}, // TODO(shutej): test
TypeInfo{Prefix: "Float32", Literal: "float32"},
TypeInfo{Prefix: "Float64", Literal: "float64"},
TypeInfo{Prefix: "Blob", Literal: "[]byte"}, // TODO(shutej): test
TypeInfo{Prefix: "Int", Literal: "int"},
TypeInfo{Prefix: "Int64", Literal: "int64"},
TypeInfo{Prefix: "Time", Literal: "time.Time"},
TypeInfo{Prefix: "NullBool", Literal: "sql.NullBool"},
TypeInfo{Prefix: "NullDate", Literal: "NullableDate"}, // TODO(shutej): test
TypeInfo{Prefix: "NullDatetime", Literal: "NullableDatetime"}, // TODO(shutej): test
TypeInfo{Prefix: "NullFloat32", Literal: "sql.NullFloat64"}, // TODO(shutej): test
TypeInfo{Prefix: "NullFloat64", Literal: "sql.NullFloat64"},
TypeInfo{Prefix: "NullBlob", Literal: "NullableBlob"}, // TODO(shutej): test
TypeInfo{Prefix: "NullInt", Literal: "sql.NullInt64"}, // TODO(shutej): test
TypeInfo{Prefix: "NullInt64", Literal: "sql.NullInt64"},
TypeInfo{Prefix: "NullString", Literal: "sql.NullString"},
TypeInfo{Prefix: "NullTime", Literal: "NullableTime"}, // TODO(shutej): test
TypeInfo{Prefix: "String", Literal: "string"},
TypeInfo{Prefix: "Time", Literal: "time.Time"}, // TODO(shutej): test
}

type FunctionInfo struct {
Expand All @@ -27,4 +48,6 @@ var Funcs = []FunctionInfo{
FunctionInfo{Name: "Md5", Expr: "MD5(%s)"},
FunctionInfo{Name: "Lower", Expr: "LOWER(%s)"},
FunctionInfo{Name: "Hex", Expr: "HEX(%s)"},
FunctionInfo{Name: "Substr2", Expr: "SUBSTR(%s, %v)"},
FunctionInfo{Name: "Substr3", Expr: "SUBSTR(%s, %v, %v)"},
}
2 changes: 1 addition & 1 deletion sqlc/field_generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"bytes"
"fmt"
log "github.com/cihub/seelog"
"github.com/relops/sqlc/meta"
"github.com/shutej/sqlc/meta"
"io/ioutil"
"os"
"strings"
Expand Down
Loading