Deleted unused functions

This commit is contained in:
Eduard Urbach 2018-11-08 20:10:51 +09:00
parent 3eda84067d
commit 9da70decfe
3 changed files with 27 additions and 46 deletions

View File

@ -1,10 +0,0 @@
package artworks
import (
"github.com/aerogo/aero"
)
// Get artworks.
func Get(ctx *aero.Context) string {
return ctx.HTML("Coming soon™.")
}

View File

@ -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)
}

View File

@ -177,37 +177,37 @@ func extractTag(tag reflect.StructTag) string {
return t return t
} }
// BindArg is a lazy way of binding args // // BindArg is a lazy way of binding args
func BindArg(obj interface{}, tags ...string) graphql.FieldConfigArgument { // func BindArg(obj interface{}, tags ...string) graphql.FieldConfigArgument {
v := reflect.Indirect(reflect.ValueOf(obj)) // v := reflect.Indirect(reflect.ValueOf(obj))
var config = make(graphql.FieldConfigArgument) // var config = make(graphql.FieldConfigArgument)
for i := 0; i < v.NumField(); i++ { // for i := 0; i < v.NumField(); i++ {
field := v.Type().Field(i) // field := v.Type().Field(i)
mytag := extractTag(field.Tag) // mytag := extractTag(field.Tag)
if inArray(tags, mytag) { // if inArray(tags, mytag) {
config[mytag] = &graphql.ArgumentConfig{ // config[mytag] = &graphql.ArgumentConfig{
Type: getGraphType(field.Type), // Type: getGraphType(field.Type),
} // }
} // }
} // }
return config // return config
} // }
func inArray(slice interface{}, item interface{}) bool { // func inArray(slice interface{}, item interface{}) bool {
s := reflect.ValueOf(slice) // s := reflect.ValueOf(slice)
if s.Kind() != reflect.Slice { // if s.Kind() != reflect.Slice {
panic("inArray() given a non-slice type") // panic("inArray() given a non-slice type")
} // }
for i := 0; i < s.Len(); i++ { // for i := 0; i < s.Len(); i++ {
if reflect.DeepEqual(item, s.Index(i).Interface()) { // if reflect.DeepEqual(item, s.Index(i).Interface()) {
return true // return true
} // }
} // }
return false // return false
} // }