From 9da70decfeb1756abeb9051626260d5abe5a682e Mon Sep 17 00:00:00 2001 From: Eduard Urbach Date: Thu, 8 Nov 2018 20:10:51 +0900 Subject: [PATCH] Deleted unused functions --- pages/artworks/artworks.go | 10 ------- utils/ToJSON.go | 9 ------- utils/gql/BindFields.go | 54 +++++++++++++++++++------------------- 3 files changed, 27 insertions(+), 46 deletions(-) delete mode 100644 pages/artworks/artworks.go delete mode 100644 utils/ToJSON.go diff --git a/pages/artworks/artworks.go b/pages/artworks/artworks.go deleted file mode 100644 index 58b0893e..00000000 --- a/pages/artworks/artworks.go +++ /dev/null @@ -1,10 +0,0 @@ -package artworks - -import ( - "github.com/aerogo/aero" -) - -// Get artworks. -func Get(ctx *aero.Context) string { - return ctx.HTML("Coming soon™.") -} diff --git a/utils/ToJSON.go b/utils/ToJSON.go deleted file mode 100644 index 2d861acf..00000000 --- a/utils/ToJSON.go +++ /dev/null @@ -1,9 +0,0 @@ -package utils - -import jsoniter "github.com/json-iterator/go" - -// ToJSON converts an object to a JSON string, ignoring errors. -func ToJSON(v interface{}) string { - str, _ := jsoniter.Marshal(v) - return string(str) -} diff --git a/utils/gql/BindFields.go b/utils/gql/BindFields.go index 5215f8fc..99869740 100644 --- a/utils/gql/BindFields.go +++ b/utils/gql/BindFields.go @@ -177,37 +177,37 @@ func extractTag(tag reflect.StructTag) string { return t } -// BindArg is a lazy way of binding args -func BindArg(obj interface{}, tags ...string) graphql.FieldConfigArgument { - v := reflect.Indirect(reflect.ValueOf(obj)) - var config = make(graphql.FieldConfigArgument) +// // BindArg is a lazy way of binding args +// func BindArg(obj interface{}, tags ...string) graphql.FieldConfigArgument { +// v := reflect.Indirect(reflect.ValueOf(obj)) +// var config = make(graphql.FieldConfigArgument) - for i := 0; i < v.NumField(); i++ { - field := v.Type().Field(i) - mytag := extractTag(field.Tag) +// for i := 0; i < v.NumField(); i++ { +// field := v.Type().Field(i) +// mytag := extractTag(field.Tag) - if inArray(tags, mytag) { - config[mytag] = &graphql.ArgumentConfig{ - Type: getGraphType(field.Type), - } - } - } +// if inArray(tags, mytag) { +// config[mytag] = &graphql.ArgumentConfig{ +// Type: getGraphType(field.Type), +// } +// } +// } - return config -} +// return config +// } -func inArray(slice interface{}, item interface{}) bool { - s := reflect.ValueOf(slice) +// func inArray(slice interface{}, item interface{}) bool { +// s := reflect.ValueOf(slice) - if s.Kind() != reflect.Slice { - panic("inArray() given a non-slice type") - } +// if s.Kind() != reflect.Slice { +// panic("inArray() given a non-slice type") +// } - for i := 0; i < s.Len(); i++ { - if reflect.DeepEqual(item, s.Index(i).Interface()) { - return true - } - } +// for i := 0; i < s.Len(); i++ { +// if reflect.DeepEqual(item, s.Index(i).Interface()) { +// return true +// } +// } - return false -} +// return false +// }