From 4823a0f1147c28034b80c8416d8a69399525912d Mon Sep 17 00:00:00 2001 From: astaxie Date: Thu, 17 Sep 2015 23:47:26 +0800 Subject: [PATCH] remove the dead code --- cache/conv.go | 12 ------------ orm/db_alias.go | 2 +- orm/utils.go | 18 ------------------ session/redis/sess_redis.go | 2 -- templatefunc.go | 1 - utils/debug.go | 14 ++++---------- 6 files changed, 5 insertions(+), 44 deletions(-) diff --git a/cache/conv.go b/cache/conv.go index 16ef1106..dbdff1c7 100644 --- a/cache/conv.go +++ b/cache/conv.go @@ -98,15 +98,3 @@ func GetBool(v interface{}) bool { } return false } - -// getByteArray convert interface to byte slice. -func getByteArray(v interface{}) []byte { - switch result := v.(type) { - case []byte: - return result - case string: - return []byte(result) - default: - return nil - } -} diff --git a/orm/db_alias.go b/orm/db_alias.go index 7918300e..79576b8e 100644 --- a/orm/db_alias.go +++ b/orm/db_alias.go @@ -63,7 +63,7 @@ var ( dbBasers = map[DriverType]dbBaser{ DRMySQL: newdbBaseMysql(), DRSqlite: newdbBaseSqlite(), - DROracle: newdbBaseMysql(), + DROracle: newdbBaseOracle(), DRPostgres: newdbBasePostgres(), DRTiDB: newdbBaseTidb(), } diff --git a/orm/utils.go b/orm/utils.go index f9af2515..99437c7b 100644 --- a/orm/utils.go +++ b/orm/utils.go @@ -249,30 +249,12 @@ func (a argInt) Get(i int, args ...int) (r int) { return } -type argAny []interface{} - -// get interface by index from interface slice -func (a argAny) Get(i int, args ...interface{}) (r interface{}) { - if i >= 0 && i < len(a) { - r = a[i] - } - if len(args) > 0 { - r = args[0] - } - return -} - // parse time to string with location func timeParse(dateString, format string) (time.Time, error) { tp, err := time.ParseInLocation(format, dateString, DefaultTimeLoc) return tp, err } -// format time string -func timeFormat(t time.Time, format string) string { - return t.Format(format) -} - // get pointer indirect type func indirectType(v reflect.Type) reflect.Type { switch v.Kind() { diff --git a/session/redis/sess_redis.go b/session/redis/sess_redis.go index 18e1f888..6e85c449 100644 --- a/session/redis/sess_redis.go +++ b/session/redis/sess_redis.go @@ -48,8 +48,6 @@ var redispder = &Provider{} // redis max pool size var MaxPoolSize = 100 -var redisPool chan redis.Conn - // SessionStore redis session store type SessionStore struct { p *redis.Pool diff --git a/templatefunc.go b/templatefunc.go index 62548659..e944bc73 100644 --- a/templatefunc.go +++ b/templatefunc.go @@ -518,7 +518,6 @@ const ( complexKind intKind floatKind - integerKind stringKind uintKind ) diff --git a/utils/debug.go b/utils/debug.go index 2462e980..93c27b70 100644 --- a/utils/debug.go +++ b/utils/debug.go @@ -26,12 +26,6 @@ var ( dunno = []byte("???") centerDot = []byte("ยท") dot = []byte(".") - lbr = []byte("{") - lbrn = []byte("{\n") - com = []byte(",") - comn = []byte(",\n") - rbr = []byte("}") - comnrbr = []byte(",\n}") ) type pointerInfo struct { @@ -376,8 +370,8 @@ func printKeyValue(buf *bytes.Buffer, val reflect.Value, pointers **pointerInfo, } } -// dump pointer value -func printPointerInfo(buf *bytes.Buffer, headlen int, pointers *pointerInfo) { +// PrintPointerInfo dump pointer value +func PrintPointerInfo(buf *bytes.Buffer, headlen int, pointers *pointerInfo) { var anyused = false var pointerNum = 0 @@ -444,8 +438,8 @@ func printPointerInfo(buf *bytes.Buffer, headlen int, pointers *pointerInfo) { } } -// get stack bytes -func stack(skip int, indent string) []byte { +// Stack get stack bytes +func Stack(skip int, indent string) []byte { var buf = new(bytes.Buffer) for i := skip; ; i++ {