From 700399b46bbe493bf515f25633bc4a174c67f3b9 Mon Sep 17 00:00:00 2001 From: bruce Date: Mon, 12 Jun 2023 10:48:15 +0800 Subject: [PATCH] feat(all): re-arrange file tree. --- go.mod | 2 +- {service/types => uzsdk}/application.go | 2 +- {service/types => uzsdk}/configuration.go | 2 +- {components => uzsdk}/logger/logger.go | 0 uzsdk.go => uzsdk/service.go | 15 +++++++-------- {service => uzsdk}/translations/en_US.go | 0 {service => uzsdk}/translations/translation.go | 0 {service => uzsdk}/translations/zh_CN.go | 0 8 files changed, 10 insertions(+), 11 deletions(-) rename {service/types => uzsdk}/application.go (94%) rename {service/types => uzsdk}/configuration.go (98%) rename {components => uzsdk}/logger/logger.go (100%) rename uzsdk.go => uzsdk/service.go (87%) rename {service => uzsdk}/translations/en_US.go (100%) rename {service => uzsdk}/translations/translation.go (100%) rename {service => uzsdk}/translations/zh_CN.go (100%) diff --git a/go.mod b/go.mod index ec92f59..f2added 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module git.uzoombox.com/git/uzsdk -go 1.18 +go 1.20 require ( github.com/gin-gonic/gin v1.9.1 diff --git a/service/types/application.go b/uzsdk/application.go similarity index 94% rename from service/types/application.go rename to uzsdk/application.go index f282258..5c3dd03 100644 --- a/service/types/application.go +++ b/uzsdk/application.go @@ -1,6 +1,6 @@ // Copyright 2023 nanzoom.com. All Rights Reserved. -package types +package uzsdk // Application defines structure of application's information. type Application struct { diff --git a/service/types/configuration.go b/uzsdk/configuration.go similarity index 98% rename from service/types/configuration.go rename to uzsdk/configuration.go index a7f39f9..fff9646 100644 --- a/service/types/configuration.go +++ b/uzsdk/configuration.go @@ -1,6 +1,6 @@ // Copyright 2010-2022 nanzoom.com. All Rights Reserved. -package types +package uzsdk // Configuration defines application's configuration. type Configuration struct { diff --git a/components/logger/logger.go b/uzsdk/logger/logger.go similarity index 100% rename from components/logger/logger.go rename to uzsdk/logger/logger.go diff --git a/uzsdk.go b/uzsdk/service.go similarity index 87% rename from uzsdk.go rename to uzsdk/service.go index fe6e0ed..503ce1e 100644 --- a/uzsdk.go +++ b/uzsdk/service.go @@ -3,9 +3,8 @@ package uzsdk import ( - "git.uzoombox.com/git/uzsdk/components/logger" - "git.uzoombox.com/git/uzsdk/service/translations" - "git.uzoombox.com/git/uzsdk/service/types" + "git.uzoombox.com/git/uzsdk/uzsdk/logger" + "git.uzoombox.com/git/uzsdk/uzsdk/translations" "github.com/gin-gonic/gin" "github.com/jmoiron/sqlx" ) @@ -131,9 +130,9 @@ func Respcode(code string, options ...interface{}) Respnode { // Instance is the framework's instance, used for server & plugin both. type Instance struct { - Conf *types.Configuration // configuration of this application. - Db *sqlx.DB // the first database connection created by main routine. - Logger *logger.Logger // logger created by main routine. - Router *gin.Engine // default webservice engine created by main routine. - Maintenance bool // when maintenance mode is true, only serve api /config. + Conf *Configuration // configuration of this application. + Db *sqlx.DB // the first database connection created by main routine. + Logger *logger.Logger // logger created by main routine. + Router *gin.Engine // default webservice engine created by main routine. + Maintenance bool // when maintenance mode is true, only serve api /config. } diff --git a/service/translations/en_US.go b/uzsdk/translations/en_US.go similarity index 100% rename from service/translations/en_US.go rename to uzsdk/translations/en_US.go diff --git a/service/translations/translation.go b/uzsdk/translations/translation.go similarity index 100% rename from service/translations/translation.go rename to uzsdk/translations/translation.go diff --git a/service/translations/zh_CN.go b/uzsdk/translations/zh_CN.go similarity index 100% rename from service/translations/zh_CN.go rename to uzsdk/translations/zh_CN.go -- 2.43.5