Browse Source

구조적인 변경

잉여개발기 (SPDV) 2 years ago
parent
commit
02d8dfcc84

BIN
route_go/bin/main.amd64.bin


BIN
route_go/bin/main.amd64.exe


BIN
route_go/bin/main.arm64.bin


BIN
route_go/bin/main.arm64.exe


+ 24 - 20
route_go/main.go

@@ -1,6 +1,7 @@
 package main
 
 import (
+	"fmt"
 	"log"
 	"opennamu/route"
 	"os"
@@ -11,47 +12,50 @@ func main() {
 
 	log.SetFlags(log.LstdFlags | log.Lshortfile)
 
+	var route_data string
 	if call_arg[0] == "main_func_easter_egg" {
-		route.Main_func_easter_egg()
+		route_data = route.Main_func_easter_egg()
 	} else if call_arg[0] == "api_w_raw" {
-		route.Api_w_raw(call_arg[1:])
+		route_data = route.Api_w_raw(call_arg[1:])
 	} else if call_arg[0] == "api_func_sha224" {
-		route.Api_func_sha224(call_arg[1:])
+		route_data = route.Api_func_sha224(call_arg[1:])
 	} else if call_arg[0] == "api_w_random" {
-		route.Api_w_random(call_arg[1:])
+		route_data = route.Api_w_random(call_arg[1:])
 	} else if call_arg[0] == "api_search" {
-		route.Api_search(call_arg[1:])
+		route_data = route.Api_search(call_arg[1:])
 	} else if call_arg[0] == "api_topic" {
-		route.Api_thread(call_arg[1:])
+		route_data = route.Api_thread(call_arg[1:])
 	} else if call_arg[0] == "api_func_ip" {
-		route.Api_func_ip(call_arg[1:])
+		route_data = route.Api_func_ip(call_arg[1:])
 	} else if call_arg[0] == "api_list_recent_change" {
-		route.Api_list_recent_change(call_arg[1:])
+		route_data = route.Api_list_recent_change(call_arg[1:])
 	} else if call_arg[0] == "api_list_recent_edit_request" {
-		route.Api_list_recent_edit_request(call_arg[1:])
+		route_data = route.Api_list_recent_edit_request(call_arg[1:])
 	} else if call_arg[0] == "api_bbs" {
-		route.Api_bbs(call_arg[1:])
+		route_data = route.Api_bbs(call_arg[1:])
 	} else if call_arg[0] == "api_w_xref" {
-		route.Api_w_xref(call_arg[1:])
+		route_data = route.Api_w_xref(call_arg[1:])
 	} else if call_arg[0] == "api_w_watch_list" {
-		route.Api_w_watch_list(call_arg[1:])
+		route_data = route.Api_w_watch_list(call_arg[1:])
 	} else if call_arg[0] == "api_user_watch_list" {
-		route.Api_user_watch_list(call_arg[1:])
+		route_data = route.Api_user_watch_list(call_arg[1:])
 	} else if call_arg[0] == "api_w_render" {
-		route.Api_w_render(call_arg[1:])
+		route_data = route.Api_w_render(call_arg[1:])
 	} else if call_arg[0] == "api_func_llm" {
-		route.Api_func_llm(call_arg[1:])
+		route_data = route.Api_func_llm(call_arg[1:])
 	} else if call_arg[0] == "api_func_language" {
-		route.Api_func_language(call_arg[1:])
+		route_data = route.Api_func_language(call_arg[1:])
 	} else if call_arg[0] == "api_func_auth_list" {
-		route.Api_func_auth_list(call_arg[1:])
+		route_data = route.Api_func_auth_list(call_arg[1:])
 	} else if call_arg[0] == "api_list_recent_discuss" {
-		route.Api_list_recent_discuss(call_arg[1:])
+		route_data = route.Api_list_recent_discuss(call_arg[1:])
 	} else if call_arg[0] == "api_bbs_list" {
-		route.Api_bbs_list(call_arg[1:])
+		route_data = route.Api_bbs_list(call_arg[1:])
 	} else if call_arg[0] == "api_list_old_page" {
-		route.Api_list_old_page(call_arg[1:])
+		route_data = route.Api_list_old_page(call_arg[1:])
 	} else {
 		log.Fatal("404")
 	}
+
+	fmt.Print(route_data)
 }

+ 3 - 7
route_go/route/api_bbs.go

@@ -3,13 +3,12 @@ package route
 import (
 	"database/sql"
 	"encoding/json"
-	"fmt"
 	"log"
 	"opennamu/route/tool"
 	"strconv"
 )
 
-func Api_bbs(call_arg []string) {
+func Api_bbs(call_arg []string) string {
 	db_set := map[string]string{}
 	json.Unmarshal([]byte(call_arg[0]), &db_set)
 
@@ -17,9 +16,6 @@ func Api_bbs(call_arg []string) {
 	json.Unmarshal([]byte(call_arg[1]), &other_set)
 
 	db := tool.DB_connect(db_set)
-	if db == nil {
-		return
-	}
 	defer db.Close()
 
 	var rows *sql.Rows
@@ -115,9 +111,9 @@ func Api_bbs(call_arg []string) {
 	}
 
 	if len(data_list) == 0 {
-		fmt.Print("{}")
+		return "{}"
 	} else {
 		json_data, _ := json.Marshal(data_list)
-		fmt.Print(string(json_data))
+		return string(json_data)
 	}
 }

+ 3 - 7
route_go/route/api_bbs_list.go

@@ -3,7 +3,6 @@ package route
 import (
 	"database/sql"
 	"encoding/json"
-	"fmt"
 	"log"
 	"opennamu/route/tool"
 )
@@ -32,14 +31,11 @@ func bbs_list(db *sql.DB, db_set map[string]string) map[string]string {
 	return data_list
 }
 
-func Api_bbs_list(call_arg []string) {
+func Api_bbs_list(call_arg []string) string {
 	db_set := map[string]string{}
 	json.Unmarshal([]byte(call_arg[0]), &db_set)
 
 	db := tool.DB_connect(db_set)
-	if db == nil {
-		return
-	}
 	defer db.Close()
 
 	data_list := bbs_list(db, db_set)
@@ -84,9 +80,9 @@ func Api_bbs_list(call_arg []string) {
 	}
 
 	if len(data_list_sub) == 0 {
-		fmt.Print("{}")
+		return "{}"
 	} else {
 		json_data, _ := json.Marshal(data_list_sub)
-		fmt.Print(string(json_data))
+		return string(json_data)
 	}
 }

+ 2 - 6
route_go/route/api_func_auth_list.go

@@ -2,11 +2,10 @@ package route
 
 import (
 	"encoding/json"
-	"fmt"
 	"opennamu/route/tool"
 )
 
-func Api_func_auth_list(call_arg []string) {
+func Api_func_auth_list(call_arg []string) string {
 	db_set := map[string]string{}
 	json.Unmarshal([]byte(call_arg[0]), &db_set)
 
@@ -14,14 +13,11 @@ func Api_func_auth_list(call_arg []string) {
 	json.Unmarshal([]byte(call_arg[1]), &other_set)
 
 	db := tool.DB_connect(db_set)
-	if db == nil {
-		return
-	}
 	defer db.Close()
 
 	auth_name := tool.Get_user_auth(db, db_set, other_set["ip"])
 	auth_info := tool.Get_auth_group_info(db, db_set, auth_name)
 
 	json_data, _ := json.Marshal(auth_info)
-	fmt.Print(string(json_data))
+	return string(json_data)
 }

+ 2 - 6
route_go/route/api_func_ip.go

@@ -2,12 +2,11 @@ package route
 
 import (
 	"encoding/json"
-	"fmt"
 
 	"opennamu/route/tool"
 )
 
-func Api_func_ip(call_arg []string) {
+func Api_func_ip(call_arg []string) string {
 	db_set := map[string]string{}
 	json.Unmarshal([]byte(call_arg[0]), &db_set)
 
@@ -15,9 +14,6 @@ func Api_func_ip(call_arg []string) {
 	json.Unmarshal([]byte(call_arg[1]), &other_set)
 
 	db := tool.DB_connect(db_set)
-	if db == nil {
-		return
-	}
 	defer db.Close()
 
 	ip_data := tool.IP_parser(db, db_set, other_set["data"], other_set["ip"])
@@ -26,5 +22,5 @@ func Api_func_ip(call_arg []string) {
 	new_data["data"] = ip_data
 
 	json_data, _ := json.Marshal(new_data)
-	fmt.Print(string(json_data))
+	return string(json_data)
 }

+ 2 - 6
route_go/route/api_func_language.go

@@ -2,11 +2,10 @@ package route
 
 import (
 	"encoding/json"
-	"fmt"
 	"opennamu/route/tool"
 )
 
-func Api_func_language(call_arg []string) {
+func Api_func_language(call_arg []string) string {
 	db_set := map[string]string{}
 	json.Unmarshal([]byte(call_arg[0]), &db_set)
 
@@ -14,9 +13,6 @@ func Api_func_language(call_arg []string) {
 	json.Unmarshal([]byte(call_arg[1]), &other_set)
 
 	db := tool.DB_connect(db_set)
-	if db == nil {
-		return
-	}
 	defer db.Close()
 
 	data_list := map[string][]string{}
@@ -29,5 +25,5 @@ func Api_func_language(call_arg []string) {
 	}
 
 	json_data, _ := json.Marshal(data_list)
-	fmt.Print(string(json_data))
+	return string(json_data)
 }

+ 2 - 6
route_go/route/api_func_llm.go

@@ -4,7 +4,6 @@ import (
 	"context"
 	"database/sql"
 	"encoding/json"
-	"fmt"
 	"log"
 	"opennamu/route/tool"
 
@@ -12,7 +11,7 @@ import (
 	"google.golang.org/api/option"
 )
 
-func Api_func_llm(call_arg []string) {
+func Api_func_llm(call_arg []string) string {
 	db_set := map[string]string{}
 	json.Unmarshal([]byte(call_arg[0]), &db_set)
 
@@ -20,9 +19,6 @@ func Api_func_llm(call_arg []string) {
 	json.Unmarshal([]byte(call_arg[1]), &other_set)
 
 	db := tool.DB_connect(db_set)
-	if db == nil {
-		return
-	}
 	defer db.Close()
 
 	var api_key string
@@ -59,5 +55,5 @@ func Api_func_llm(call_arg []string) {
 	text := resp.Candidates[0].Content.Parts[0]
 
 	json_data, _ := json.Marshal(map[string]genai.Part{"data": text})
-	fmt.Print(string(json_data))
+	return string(json_data)
 }

+ 2 - 3
route_go/route/api_func_sha224.go

@@ -2,12 +2,11 @@ package route
 
 import (
 	"encoding/json"
-	"fmt"
 
 	"opennamu/route/tool"
 )
 
-func Api_func_sha224(call_arg []string) {
+func Api_func_sha224(call_arg []string) string {
 	data := call_arg[0]
 
 	hash_str := tool.Sha224(data)
@@ -16,5 +15,5 @@ func Api_func_sha224(call_arg []string) {
 	new_data["data"] = hash_str
 
 	json_data, _ := json.Marshal(new_data)
-	fmt.Print(string(json_data))
+	return string(json_data)
 }

+ 2 - 6
route_go/route/api_list_old_page.go

@@ -3,13 +3,12 @@ package route
 import (
 	"database/sql"
 	"encoding/json"
-	"fmt"
 	"log"
 	"opennamu/route/tool"
 	"strconv"
 )
 
-func Api_list_old_page(call_arg []string) {
+func Api_list_old_page(call_arg []string) string {
 	db_set := map[string]string{}
 	json.Unmarshal([]byte(call_arg[0]), &db_set)
 
@@ -17,9 +16,6 @@ func Api_list_old_page(call_arg []string) {
 	json.Unmarshal([]byte(call_arg[1]), &other_set)
 
 	db := tool.DB_connect(db_set)
-	if db == nil {
-		return
-	}
 	defer db.Close()
 
 	page_int, err := strconv.Atoi(other_set["num"])
@@ -81,5 +77,5 @@ func Api_list_old_page(call_arg []string) {
 	}
 
 	json_data, _ := json.Marshal(return_data)
-	fmt.Print(string(json_data))
+	return string(json_data)
 }

+ 4 - 8
route_go/route/api_list_recent_change.go

@@ -3,13 +3,12 @@ package route
 import (
 	"database/sql"
 	"encoding/json"
-	"fmt"
 	"log"
 	"opennamu/route/tool"
 	"strconv"
 )
 
-func Api_list_recent_change(call_arg []string) {
+func Api_list_recent_change(call_arg []string) string {
 	db_set := map[string]string{}
 	json.Unmarshal([]byte(call_arg[0]), &db_set)
 
@@ -17,9 +16,6 @@ func Api_list_recent_change(call_arg []string) {
 	json.Unmarshal([]byte(call_arg[1]), &other_set)
 
 	db := tool.DB_connect(db_set)
-	if db == nil {
-		return
-	}
 	defer db.Close()
 
 	set_type := other_set["set_type"]
@@ -132,10 +128,10 @@ func Api_list_recent_change(call_arg []string) {
 
 	if other_set["legacy"] != "" {
 		if len(data_list) == 0 {
-			fmt.Print("{}")
+			return "{}"
 		} else {
 			json_data, _ := json.Marshal(data_list)
-			fmt.Print(string(json_data))
+			return string(json_data)
 		}
 	} else {
 		auth_name := tool.Get_user_auth(db, db_set, other_set["ip"])
@@ -170,6 +166,6 @@ func Api_list_recent_change(call_arg []string) {
 		}
 
 		json_data, _ := json.Marshal(return_data)
-		fmt.Print(string(json_data))
+		return string(json_data)
 	}
 }

+ 4 - 8
route_go/route/api_list_recent_discuss.go

@@ -3,13 +3,12 @@ package route
 import (
 	"database/sql"
 	"encoding/json"
-	"fmt"
 	"log"
 	"opennamu/route/tool"
 	"strconv"
 )
 
-func Api_list_recent_discuss(call_arg []string) {
+func Api_list_recent_discuss(call_arg []string) string {
 	db_set := map[string]string{}
 	json.Unmarshal([]byte(call_arg[0]), &db_set)
 
@@ -17,9 +16,6 @@ func Api_list_recent_discuss(call_arg []string) {
 	json.Unmarshal([]byte(call_arg[1]), &other_set)
 
 	db := tool.DB_connect(db_set)
-	if db == nil {
-		return
-	}
 	defer db.Close()
 
 	limit_int, err := strconv.Atoi(other_set["limit"])
@@ -124,10 +120,10 @@ func Api_list_recent_discuss(call_arg []string) {
 
 	if other_set["legacy"] != "" {
 		if len(data_list) == 0 {
-			fmt.Print("{}")
+			return "{}"
 		} else {
 			json_data, _ := json.Marshal(data_list)
-			fmt.Print(string(json_data))
+			return string(json_data)
 		}
 	} else {
 		auth_name := tool.Get_user_auth(db, db_set, other_set["ip"])
@@ -150,6 +146,6 @@ func Api_list_recent_discuss(call_arg []string) {
 		}
 
 		json_data, _ := json.Marshal(return_data)
-		fmt.Print(string(json_data))
+		return string(json_data)
 	}
 }

+ 3 - 7
route_go/route/api_list_recent_edit_request.go

@@ -3,13 +3,12 @@ package route
 import (
 	"database/sql"
 	"encoding/json"
-	"fmt"
 	"log"
 	"opennamu/route/tool"
 	"strconv"
 )
 
-func Api_list_recent_edit_request(call_arg []string) {
+func Api_list_recent_edit_request(call_arg []string) string {
 	db_set := map[string]string{}
 	json.Unmarshal([]byte(call_arg[0]), &db_set)
 
@@ -17,9 +16,6 @@ func Api_list_recent_edit_request(call_arg []string) {
 	json.Unmarshal([]byte(call_arg[1]), &other_set)
 
 	db := tool.DB_connect(db_set)
-	if db == nil {
-		return
-	}
 	defer db.Close()
 
 	limit_int, err := strconv.Atoi(other_set["limit"])
@@ -115,9 +111,9 @@ func Api_list_recent_edit_request(call_arg []string) {
 	}
 
 	if len(data_list) == 0 {
-		fmt.Print("{}")
+		return "{}"
 	} else {
 		json_data, _ := json.Marshal(data_list)
-		fmt.Print(string(json_data))
+		return string(json_data)
 	}
 }

+ 5 - 9
route_go/route/api_search.go

@@ -2,14 +2,13 @@ package route
 
 import (
 	"encoding/json"
-	"fmt"
 	"log"
 	"strconv"
 
 	"opennamu/route/tool"
 )
 
-func Api_search(call_arg []string) {
+func Api_search(call_arg []string) string {
 	db_set := map[string]string{}
 	json.Unmarshal([]byte(call_arg[0]), &db_set)
 
@@ -23,9 +22,6 @@ func Api_search(call_arg []string) {
 	}
 
 	db := tool.DB_connect(db_set)
-	if db == nil {
-		return
-	}
 	defer db.Close()
 
 	if other_set["search_type"] == "title" {
@@ -54,10 +50,10 @@ func Api_search(call_arg []string) {
 		}
 
 		if len(title_list) == 0 {
-			fmt.Print("{}")
+			return "{}"
 		} else {
 			json_data, _ := json.Marshal(title_list)
-			fmt.Print(string(json_data))
+			return string(json_data)
 		}
 	} else {
 		stmt, err := db.Prepare(tool.DB_change(db_set, "select title from data where data collate nocase like ? order by title limit ?, 50"))
@@ -85,10 +81,10 @@ func Api_search(call_arg []string) {
 		}
 
 		if len(title_list) == 0 {
-			fmt.Print("{}")
+			return "{}"
 		} else {
 			json_data, _ := json.Marshal(title_list)
-			fmt.Print(string(json_data))
+			return string(json_data)
 		}
 	}
 }

+ 3 - 7
route_go/route/api_thread.go

@@ -3,13 +3,12 @@ package route
 import (
 	"database/sql"
 	"encoding/json"
-	"fmt"
 	"log"
 
 	"opennamu/route/tool"
 )
 
-func Api_thread(call_arg []string) {
+func Api_thread(call_arg []string) string {
 	db_set := map[string]string{}
 	json.Unmarshal([]byte(call_arg[0]), &db_set)
 
@@ -17,9 +16,6 @@ func Api_thread(call_arg []string) {
 	json.Unmarshal([]byte(call_arg[1]), &other_set)
 
 	db := tool.DB_connect(db_set)
-	if db == nil {
-		return
-	}
 	defer db.Close()
 
 	if other_set["tool"] == "length" {
@@ -43,7 +39,7 @@ func Api_thread(call_arg []string) {
 		new_data["length"] = length
 
 		json_data, _ := json.Marshal(new_data)
-		fmt.Print(string(json_data))
+		return string(json_data)
 	} else {
 		var rows *sql.Rows
 
@@ -126,6 +122,6 @@ func Api_thread(call_arg []string) {
 		}
 
 		json_data, _ := json.Marshal(new_data)
-		fmt.Print(string(json_data))
+		return string(json_data)
 	}
 }

+ 5 - 0
route_go/route/api_topic_list.go

@@ -0,0 +1,5 @@
+package route
+
+func Api_topic_list() string {
+	return ""
+}

+ 4 - 9
route_go/route/api_user_watch_list.go

@@ -3,13 +3,12 @@ package route
 import (
 	"database/sql"
 	"encoding/json"
-	"fmt"
 	"log"
 	"opennamu/route/tool"
 	"strconv"
 )
 
-func Api_user_watch_list(call_arg []string) {
+func Api_user_watch_list(call_arg []string) string {
 	db_set := map[string]string{}
 	json.Unmarshal([]byte(call_arg[0]), &db_set)
 
@@ -23,16 +22,12 @@ func Api_user_watch_list(call_arg []string) {
 	}
 
 	db := tool.DB_connect(db_set)
-	if db == nil {
-		return
-	}
 	defer db.Close()
 
 	ip := other_set["ip"]
 	name := other_set["name"]
 	if ip != name && tool.Get_user_auth(db, db_set, ip) == "" {
-		fmt.Print("{}")
-		return
+		return "{}"
 	}
 
 	var stmt *sql.Stmt
@@ -67,9 +62,9 @@ func Api_user_watch_list(call_arg []string) {
 	}
 
 	if len(data_list) == 0 {
-		fmt.Print("{}")
+		return "{}"
 	} else {
 		json_data, _ := json.Marshal(data_list)
-		fmt.Print(string(json_data))
+		return string(json_data)
 	}
 }

+ 2 - 6
route_go/route/api_w_random.go

@@ -3,20 +3,16 @@ package route
 import (
 	"database/sql"
 	"encoding/json"
-	"fmt"
 	"log"
 
 	"opennamu/route/tool"
 )
 
-func Api_w_random(call_arg []string) {
+func Api_w_random(call_arg []string) string {
 	db_set := map[string]string{}
 	json.Unmarshal([]byte(call_arg[0]), &db_set)
 
 	db := tool.DB_connect(db_set)
-	if db == nil {
-		return
-	}
 	defer db.Close()
 
 	var title string
@@ -34,5 +30,5 @@ func Api_w_random(call_arg []string) {
 	new_data["data"] = title
 
 	json_data, _ := json.Marshal(new_data)
-	fmt.Print(string(json_data))
+	return string(json_data)
 }

+ 4 - 8
route_go/route/api_w_raw.go

@@ -3,13 +3,12 @@ package route
 import (
 	"database/sql"
 	"encoding/json"
-	"fmt"
 	"log"
 
 	"opennamu/route/tool"
 )
 
-func Api_w_raw(call_arg []string) {
+func Api_w_raw(call_arg []string) string {
 	db_set := map[string]string{}
 	json.Unmarshal([]byte(call_arg[0]), &db_set)
 
@@ -17,9 +16,6 @@ func Api_w_raw(call_arg []string) {
 	json.Unmarshal([]byte(call_arg[1]), &other_set)
 
 	db := tool.DB_connect(db_set)
-	if db == nil {
-		return
-	}
 	defer db.Close()
 
 	if other_set["exist_check"] != "" {
@@ -43,7 +39,7 @@ func Api_w_raw(call_arg []string) {
 		}
 
 		json_data, _ := json.Marshal(new_data)
-		fmt.Print(string(json_data))
+		return string(json_data)
 	} else {
 		new_data := map[string]string{}
 		var data string
@@ -67,7 +63,7 @@ func Api_w_raw(call_arg []string) {
 			}
 
 			json_data, _ := json.Marshal(new_data)
-			fmt.Print(string(json_data))
+			return string(json_data)
 		} else {
 			stmt, err := db.Prepare(tool.DB_change(db_set, "select data from data where title = ?"))
 			if err != nil {
@@ -87,7 +83,7 @@ func Api_w_raw(call_arg []string) {
 			}
 
 			json_data, _ := json.Marshal(new_data)
-			fmt.Print(string(json_data))
+			return string(json_data)
 		}
 	}
 }

+ 2 - 6
route_go/route/api_w_render.go

@@ -2,11 +2,10 @@ package route
 
 import (
 	"encoding/json"
-	"fmt"
 	"opennamu/route/tool"
 )
 
-func Api_w_render(call_arg []string) {
+func Api_w_render(call_arg []string) string {
 	db_set := map[string]string{}
 	json.Unmarshal([]byte(call_arg[0]), &db_set)
 
@@ -14,13 +13,10 @@ func Api_w_render(call_arg []string) {
 	json.Unmarshal([]byte(call_arg[1]), &other_set)
 
 	db := tool.DB_connect(db_set)
-	if db == nil {
-		return
-	}
 	defer db.Close()
 
 	data := tool.Get_render(db, db_set, other_set["doc_name"], other_set["data"], other_set["render_type"])
 
 	json_data, _ := json.Marshal(data)
-	fmt.Print(string(json_data))
+	return string(json_data)
 }

+ 4 - 9
route_go/route/api_w_watch_list.go

@@ -3,13 +3,12 @@ package route
 import (
 	"database/sql"
 	"encoding/json"
-	"fmt"
 	"log"
 	"opennamu/route/tool"
 	"strconv"
 )
 
-func Api_w_watch_list(call_arg []string) {
+func Api_w_watch_list(call_arg []string) string {
 	db_set := map[string]string{}
 	json.Unmarshal([]byte(call_arg[0]), &db_set)
 
@@ -23,15 +22,11 @@ func Api_w_watch_list(call_arg []string) {
 	}
 
 	db := tool.DB_connect(db_set)
-	if db == nil {
-		return
-	}
 	defer db.Close()
 
 	ip := other_set["ip"]
 	if tool.Get_user_auth(db, db_set, ip) == "" {
-		fmt.Print("{}")
-		return
+		return "{}"
 	}
 
 	var stmt *sql.Stmt
@@ -66,9 +61,9 @@ func Api_w_watch_list(call_arg []string) {
 	}
 
 	if len(data_list) == 0 {
-		fmt.Print("{}")
+		return "{}"
 	} else {
 		json_data, _ := json.Marshal(data_list)
-		fmt.Print(string(json_data))
+		return string(json_data)
 	}
 }

+ 3 - 7
route_go/route/api_w_xref.go

@@ -3,13 +3,12 @@ package route
 import (
 	"database/sql"
 	"encoding/json"
-	"fmt"
 	"log"
 	"opennamu/route/tool"
 	"strconv"
 )
 
-func Api_w_xref(call_arg []string) {
+func Api_w_xref(call_arg []string) string {
 	db_set := map[string]string{}
 	json.Unmarshal([]byte(call_arg[0]), &db_set)
 
@@ -17,9 +16,6 @@ func Api_w_xref(call_arg []string) {
 	json.Unmarshal([]byte(call_arg[1]), &other_set)
 
 	db := tool.DB_connect(db_set)
-	if db == nil {
-		return
-	}
 	defer db.Close()
 
 	page, _ := strconv.Atoi(other_set["page"])
@@ -76,9 +72,9 @@ func Api_w_xref(call_arg []string) {
 	}
 
 	if len(data_list) == 0 {
-		fmt.Print("{}")
+		return "{}"
 	} else {
 		json_data, _ := json.Marshal(data_list)
-		fmt.Print(string(json_data))
+		return string(json_data)
 	}
 }

+ 2 - 3
route_go/route/main_func_easter_egg.go

@@ -1,11 +1,10 @@
 package route
 
 import (
-	"fmt"
 	"math/rand"
 )
 
-func Main_func_easter_egg() {
+func Main_func_easter_egg() string {
 	select_list := []string{
 		"PWD0ZbR7AOY", // Shanghai Teahouse ~ Chinese Tea
 		"HoU29ljOmTE", // Flawless Clothing of Celestials
@@ -30,5 +29,5 @@ func Main_func_easter_egg() {
 	}
 	select_str := select_list[rand.Intn(len(select_list)-1)]
 
-	fmt.Print("<iframe width=\"640\" height=\"360\" src=\"https://www.youtube.com/embed/" + select_str + "\" frameborder=\"0\" allowfullscreen></iframe>")
+	return "<iframe width=\"640\" height=\"360\" src=\"https://www.youtube.com/embed/" + select_str + "\" frameborder=\"0\" allowfullscreen></iframe>"
 }