modify project name

This commit is contained in:
MaysWind
2021-04-11 22:51:22 +08:00
parent f16eb8b28e
commit 62a825439f
98 changed files with 364 additions and 355 deletions
+6 -6
View File
@@ -3,12 +3,12 @@ package api
import (
"sort"
"github.com/mayswind/lab/pkg/core"
"github.com/mayswind/lab/pkg/errs"
"github.com/mayswind/lab/pkg/log"
"github.com/mayswind/lab/pkg/models"
"github.com/mayswind/lab/pkg/services"
"github.com/mayswind/lab/pkg/validators"
"github.com/mayswind/ezbookkeeping/pkg/core"
"github.com/mayswind/ezbookkeeping/pkg/errs"
"github.com/mayswind/ezbookkeeping/pkg/log"
"github.com/mayswind/ezbookkeeping/pkg/models"
"github.com/mayswind/ezbookkeeping/pkg/services"
"github.com/mayswind/ezbookkeeping/pkg/validators"
)
// AccountsApi represents account api
+5 -5
View File
@@ -3,11 +3,11 @@ package api
import (
"github.com/pquerna/otp/totp"
"github.com/mayswind/lab/pkg/core"
"github.com/mayswind/lab/pkg/errs"
"github.com/mayswind/lab/pkg/log"
"github.com/mayswind/lab/pkg/models"
"github.com/mayswind/lab/pkg/services"
"github.com/mayswind/ezbookkeeping/pkg/core"
"github.com/mayswind/ezbookkeeping/pkg/errs"
"github.com/mayswind/ezbookkeeping/pkg/log"
"github.com/mayswind/ezbookkeeping/pkg/models"
"github.com/mayswind/ezbookkeeping/pkg/services"
)
// AuthorizationsApi represents authorization api
+8 -8
View File
@@ -5,14 +5,14 @@ import (
"strings"
"time"
"github.com/mayswind/lab/pkg/core"
"github.com/mayswind/lab/pkg/errs"
"github.com/mayswind/lab/pkg/exporters"
"github.com/mayswind/lab/pkg/log"
"github.com/mayswind/lab/pkg/models"
"github.com/mayswind/lab/pkg/services"
"github.com/mayswind/lab/pkg/settings"
"github.com/mayswind/lab/pkg/utils"
"github.com/mayswind/ezbookkeeping/pkg/core"
"github.com/mayswind/ezbookkeeping/pkg/errs"
"github.com/mayswind/ezbookkeeping/pkg/exporters"
"github.com/mayswind/ezbookkeeping/pkg/log"
"github.com/mayswind/ezbookkeeping/pkg/models"
"github.com/mayswind/ezbookkeeping/pkg/services"
"github.com/mayswind/ezbookkeeping/pkg/settings"
"github.com/mayswind/ezbookkeeping/pkg/utils"
)
const pageCountForDataExport = 1000
+2 -2
View File
@@ -1,8 +1,8 @@
package api
import (
"github.com/mayswind/lab/pkg/core"
"github.com/mayswind/lab/pkg/errs"
"github.com/mayswind/ezbookkeeping/pkg/core"
"github.com/mayswind/ezbookkeeping/pkg/errs"
)
// DefaultApi represents default api
+6 -6
View File
@@ -6,12 +6,12 @@ import (
"sort"
"time"
"github.com/mayswind/lab/pkg/core"
"github.com/mayswind/lab/pkg/errs"
"github.com/mayswind/lab/pkg/exchangerates"
"github.com/mayswind/lab/pkg/log"
"github.com/mayswind/lab/pkg/models"
"github.com/mayswind/lab/pkg/settings"
"github.com/mayswind/ezbookkeeping/pkg/core"
"github.com/mayswind/ezbookkeeping/pkg/errs"
"github.com/mayswind/ezbookkeeping/pkg/exchangerates"
"github.com/mayswind/ezbookkeeping/pkg/log"
"github.com/mayswind/ezbookkeeping/pkg/models"
"github.com/mayswind/ezbookkeeping/pkg/settings"
)
// ExchangeRatesApi represents exchange rate api
+6 -6
View File
@@ -3,12 +3,12 @@ package api
import (
"sort"
"github.com/mayswind/lab/pkg/core"
"github.com/mayswind/lab/pkg/errs"
"github.com/mayswind/lab/pkg/log"
"github.com/mayswind/lab/pkg/models"
"github.com/mayswind/lab/pkg/services"
"github.com/mayswind/lab/pkg/utils"
"github.com/mayswind/ezbookkeeping/pkg/core"
"github.com/mayswind/ezbookkeeping/pkg/errs"
"github.com/mayswind/ezbookkeeping/pkg/log"
"github.com/mayswind/ezbookkeeping/pkg/models"
"github.com/mayswind/ezbookkeeping/pkg/services"
"github.com/mayswind/ezbookkeeping/pkg/utils"
)
// TokensApi represents token api
+5 -5
View File
@@ -3,11 +3,11 @@ package api
import (
"sort"
"github.com/mayswind/lab/pkg/core"
"github.com/mayswind/lab/pkg/errs"
"github.com/mayswind/lab/pkg/log"
"github.com/mayswind/lab/pkg/models"
"github.com/mayswind/lab/pkg/services"
"github.com/mayswind/ezbookkeeping/pkg/core"
"github.com/mayswind/ezbookkeeping/pkg/errs"
"github.com/mayswind/ezbookkeeping/pkg/log"
"github.com/mayswind/ezbookkeeping/pkg/models"
"github.com/mayswind/ezbookkeeping/pkg/services"
)
// TransactionCategoriesApi represents transaction category api
+5 -5
View File
@@ -3,11 +3,11 @@ package api
import (
"sort"
"github.com/mayswind/lab/pkg/core"
"github.com/mayswind/lab/pkg/errs"
"github.com/mayswind/lab/pkg/log"
"github.com/mayswind/lab/pkg/models"
"github.com/mayswind/lab/pkg/services"
"github.com/mayswind/ezbookkeeping/pkg/core"
"github.com/mayswind/ezbookkeeping/pkg/errs"
"github.com/mayswind/ezbookkeeping/pkg/log"
"github.com/mayswind/ezbookkeeping/pkg/models"
"github.com/mayswind/ezbookkeeping/pkg/services"
)
// TransactionTagsApi represents transaction tag api
+6 -6
View File
@@ -4,12 +4,12 @@ import (
"sort"
"strings"
"github.com/mayswind/lab/pkg/core"
"github.com/mayswind/lab/pkg/errs"
"github.com/mayswind/lab/pkg/log"
"github.com/mayswind/lab/pkg/models"
"github.com/mayswind/lab/pkg/services"
"github.com/mayswind/lab/pkg/utils"
"github.com/mayswind/ezbookkeeping/pkg/core"
"github.com/mayswind/ezbookkeeping/pkg/errs"
"github.com/mayswind/ezbookkeeping/pkg/log"
"github.com/mayswind/ezbookkeeping/pkg/models"
"github.com/mayswind/ezbookkeeping/pkg/services"
"github.com/mayswind/ezbookkeeping/pkg/utils"
)
const pageCountForLoadTransactionAmounts = 1000
+5 -5
View File
@@ -8,11 +8,11 @@ import (
"github.com/pquerna/otp/totp"
"github.com/mayswind/lab/pkg/core"
"github.com/mayswind/lab/pkg/errs"
"github.com/mayswind/lab/pkg/log"
"github.com/mayswind/lab/pkg/models"
"github.com/mayswind/lab/pkg/services"
"github.com/mayswind/ezbookkeeping/pkg/core"
"github.com/mayswind/ezbookkeeping/pkg/errs"
"github.com/mayswind/ezbookkeeping/pkg/log"
"github.com/mayswind/ezbookkeeping/pkg/models"
"github.com/mayswind/ezbookkeeping/pkg/services"
)
// TwoFactorAuthorizationsApi represents 2fa api
+7 -7
View File
@@ -4,13 +4,13 @@ import (
"strings"
"time"
"github.com/mayswind/lab/pkg/core"
"github.com/mayswind/lab/pkg/errs"
"github.com/mayswind/lab/pkg/log"
"github.com/mayswind/lab/pkg/models"
"github.com/mayswind/lab/pkg/services"
"github.com/mayswind/lab/pkg/settings"
"github.com/mayswind/lab/pkg/validators"
"github.com/mayswind/ezbookkeeping/pkg/core"
"github.com/mayswind/ezbookkeeping/pkg/errs"
"github.com/mayswind/ezbookkeeping/pkg/log"
"github.com/mayswind/ezbookkeeping/pkg/models"
"github.com/mayswind/ezbookkeeping/pkg/services"
"github.com/mayswind/ezbookkeeping/pkg/settings"
"github.com/mayswind/ezbookkeeping/pkg/validators"
)
// UsersApi represents user api
+6 -6
View File
@@ -5,12 +5,12 @@ import (
"github.com/urfave/cli/v2"
"github.com/mayswind/lab/pkg/errs"
"github.com/mayswind/lab/pkg/exporters"
"github.com/mayswind/lab/pkg/log"
"github.com/mayswind/lab/pkg/models"
"github.com/mayswind/lab/pkg/services"
"github.com/mayswind/lab/pkg/validators"
"github.com/mayswind/ezbookkeeping/pkg/errs"
"github.com/mayswind/ezbookkeeping/pkg/exporters"
"github.com/mayswind/ezbookkeeping/pkg/log"
"github.com/mayswind/ezbookkeeping/pkg/models"
"github.com/mayswind/ezbookkeeping/pkg/services"
"github.com/mayswind/ezbookkeeping/pkg/validators"
)
const pageCountForGettingTransactions = 1000
+1 -1
View File
@@ -5,7 +5,7 @@ import (
"github.com/gin-gonic/gin"
"github.com/mayswind/lab/pkg/errs"
"github.com/mayswind/ezbookkeeping/pkg/errs"
)
const requestIdFieldKey = "REQUEST_ID"
+1 -1
View File
@@ -1,6 +1,6 @@
package core
import "github.com/mayswind/lab/pkg/errs"
import "github.com/mayswind/ezbookkeeping/pkg/errs"
// MiddlewareHandlerFunc represents the middleware handler function
type MiddlewareHandlerFunc func(*Context)
+1 -1
View File
@@ -3,7 +3,7 @@ package datastore
import (
"xorm.io/xorm"
"github.com/mayswind/lab/pkg/errs"
"github.com/mayswind/ezbookkeeping/pkg/errs"
)
// DataStore represents a data storage containing a series of database shards
+2 -2
View File
@@ -12,8 +12,8 @@ import (
_ "github.com/mattn/go-sqlite3"
"xorm.io/xorm"
"github.com/mayswind/lab/pkg/errs"
"github.com/mayswind/lab/pkg/settings"
"github.com/mayswind/ezbookkeeping/pkg/errs"
"github.com/mayswind/ezbookkeeping/pkg/settings"
)
// DataStoreContainer contains all data storages
+2 -2
View File
@@ -3,8 +3,8 @@ package datastore
import (
xorm "xorm.io/xorm/log"
"github.com/mayswind/lab/pkg/log"
"github.com/mayswind/lab/pkg/settings"
"github.com/mayswind/ezbookkeeping/pkg/log"
"github.com/mayswind/ezbookkeeping/pkg/settings"
)
// XOrmLoggerAdapter represents the logger adapter for xorm
@@ -6,12 +6,12 @@ import (
"strings"
"time"
"github.com/mayswind/lab/pkg/core"
"github.com/mayswind/lab/pkg/errs"
"github.com/mayswind/lab/pkg/log"
"github.com/mayswind/lab/pkg/models"
"github.com/mayswind/lab/pkg/utils"
"github.com/mayswind/lab/pkg/validators"
"github.com/mayswind/ezbookkeeping/pkg/core"
"github.com/mayswind/ezbookkeeping/pkg/errs"
"github.com/mayswind/ezbookkeeping/pkg/log"
"github.com/mayswind/ezbookkeeping/pkg/models"
"github.com/mayswind/ezbookkeeping/pkg/utils"
"github.com/mayswind/ezbookkeeping/pkg/validators"
)
const bankOfCanadaExchangeRateUrl = "https://www.bankofcanada.ca/valet/observations/group/FX_RATES_DAILY/json?recent=1"
@@ -6,8 +6,8 @@ import (
"github.com/gin-gonic/gin"
"github.com/stretchr/testify/assert"
"github.com/mayswind/lab/pkg/core"
"github.com/mayswind/lab/pkg/models"
"github.com/mayswind/ezbookkeeping/pkg/core"
"github.com/mayswind/ezbookkeeping/pkg/models"
)
const bankOfCanadaMinimumRequiredContent = "{\n" +
@@ -5,12 +5,12 @@ import (
"strings"
"time"
"github.com/mayswind/lab/pkg/core"
"github.com/mayswind/lab/pkg/errs"
"github.com/mayswind/lab/pkg/log"
"github.com/mayswind/lab/pkg/models"
"github.com/mayswind/lab/pkg/utils"
"github.com/mayswind/lab/pkg/validators"
"github.com/mayswind/ezbookkeeping/pkg/core"
"github.com/mayswind/ezbookkeeping/pkg/errs"
"github.com/mayswind/ezbookkeeping/pkg/log"
"github.com/mayswind/ezbookkeeping/pkg/models"
"github.com/mayswind/ezbookkeeping/pkg/utils"
"github.com/mayswind/ezbookkeeping/pkg/validators"
)
const czechNationalBankDailyExchangeRateUrl = "https://www.cnb.cz/en/financial-markets/foreign-exchange-market/central-bank-exchange-rate-fixing/central-bank-exchange-rate-fixing/daily.txt"
@@ -6,8 +6,8 @@ import (
"github.com/gin-gonic/gin"
"github.com/stretchr/testify/assert"
"github.com/mayswind/lab/pkg/core"
"github.com/mayswind/lab/pkg/models"
"github.com/mayswind/ezbookkeeping/pkg/core"
"github.com/mayswind/ezbookkeeping/pkg/models"
)
const czechNationalBankMinimumRequiredContent = "01 Apr 2021 #64\n" +
@@ -4,12 +4,12 @@ import (
"encoding/xml"
"time"
"github.com/mayswind/lab/pkg/core"
"github.com/mayswind/lab/pkg/errs"
"github.com/mayswind/lab/pkg/log"
"github.com/mayswind/lab/pkg/models"
"github.com/mayswind/lab/pkg/utils"
"github.com/mayswind/lab/pkg/validators"
"github.com/mayswind/ezbookkeeping/pkg/core"
"github.com/mayswind/ezbookkeeping/pkg/errs"
"github.com/mayswind/ezbookkeeping/pkg/log"
"github.com/mayswind/ezbookkeeping/pkg/models"
"github.com/mayswind/ezbookkeeping/pkg/utils"
"github.com/mayswind/ezbookkeeping/pkg/validators"
)
const euroCentralBankExchangeRateUrl = "https://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml"
@@ -6,8 +6,8 @@ import (
"github.com/gin-gonic/gin"
"github.com/stretchr/testify/assert"
"github.com/mayswind/lab/pkg/core"
"github.com/mayswind/lab/pkg/models"
"github.com/mayswind/ezbookkeeping/pkg/core"
"github.com/mayswind/ezbookkeeping/pkg/models"
)
const euroCentralBankMinimumRequiredContent = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
@@ -1,8 +1,8 @@
package exchangerates
import (
"github.com/mayswind/lab/pkg/core"
"github.com/mayswind/lab/pkg/models"
"github.com/mayswind/ezbookkeeping/pkg/core"
"github.com/mayswind/ezbookkeeping/pkg/models"
)
// ExchangeRatesDataSource defines the structure of exchange rates data source
@@ -1,8 +1,8 @@
package exchangerates
import (
"github.com/mayswind/lab/pkg/errs"
"github.com/mayswind/lab/pkg/settings"
"github.com/mayswind/ezbookkeeping/pkg/errs"
"github.com/mayswind/ezbookkeeping/pkg/settings"
)
// ExchangeRatesDataSourceContainer contains the current exchange rates data source
@@ -6,12 +6,12 @@ import (
"math"
"time"
"github.com/mayswind/lab/pkg/core"
"github.com/mayswind/lab/pkg/errs"
"github.com/mayswind/lab/pkg/log"
"github.com/mayswind/lab/pkg/models"
"github.com/mayswind/lab/pkg/utils"
"github.com/mayswind/lab/pkg/validators"
"github.com/mayswind/ezbookkeeping/pkg/core"
"github.com/mayswind/ezbookkeeping/pkg/errs"
"github.com/mayswind/ezbookkeeping/pkg/log"
"github.com/mayswind/ezbookkeeping/pkg/models"
"github.com/mayswind/ezbookkeeping/pkg/utils"
"github.com/mayswind/ezbookkeeping/pkg/validators"
)
const nationalBankOfPolandDailyExchangeRateUrl = "https://www.nbp.pl/kursy/xml/en/lastaen.xml"
@@ -6,8 +6,8 @@ import (
"github.com/gin-gonic/gin"
"github.com/stretchr/testify/assert"
"github.com/mayswind/lab/pkg/core"
"github.com/mayswind/lab/pkg/models"
"github.com/mayswind/ezbookkeeping/pkg/core"
"github.com/mayswind/ezbookkeeping/pkg/models"
)
const nationalBankOfPolandMinimumRequiredContent = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n" +
@@ -4,12 +4,12 @@ import (
"encoding/xml"
"time"
"github.com/mayswind/lab/pkg/core"
"github.com/mayswind/lab/pkg/errs"
"github.com/mayswind/lab/pkg/log"
"github.com/mayswind/lab/pkg/models"
"github.com/mayswind/lab/pkg/utils"
"github.com/mayswind/lab/pkg/validators"
"github.com/mayswind/ezbookkeeping/pkg/core"
"github.com/mayswind/ezbookkeeping/pkg/errs"
"github.com/mayswind/ezbookkeeping/pkg/log"
"github.com/mayswind/ezbookkeeping/pkg/models"
"github.com/mayswind/ezbookkeeping/pkg/utils"
"github.com/mayswind/ezbookkeeping/pkg/validators"
)
const reserveBankOfAustraliaExchangeRateUrl = "https://www.rba.gov.au/rss/rss-cb-exchange-rates.xml"
@@ -6,8 +6,8 @@ import (
"github.com/gin-gonic/gin"
"github.com/stretchr/testify/assert"
"github.com/mayswind/lab/pkg/core"
"github.com/mayswind/lab/pkg/models"
"github.com/mayswind/ezbookkeeping/pkg/core"
"github.com/mayswind/ezbookkeeping/pkg/models"
)
const reserveBankOfAustraliaMinimumRequiredContent = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
+2 -2
View File
@@ -5,8 +5,8 @@ import (
"strings"
"time"
"github.com/mayswind/lab/pkg/models"
"github.com/mayswind/lab/pkg/utils"
"github.com/mayswind/ezbookkeeping/pkg/models"
"github.com/mayswind/ezbookkeeping/pkg/utils"
)
// CSVFileExporter defines the structure of csv file exporter
+1 -1
View File
@@ -3,7 +3,7 @@ package exporters
import (
"time"
"github.com/mayswind/lab/pkg/models"
"github.com/mayswind/ezbookkeeping/pkg/models"
)
// DataExporter defines the structure of data exporter
+1 -1
View File
@@ -8,7 +8,7 @@ import (
"github.com/sirupsen/logrus"
"github.com/mayswind/lab/pkg/utils"
"github.com/mayswind/ezbookkeeping/pkg/utils"
)
// LogFormatter represents a log formatter
+2 -2
View File
@@ -8,8 +8,8 @@ import (
"github.com/sirupsen/logrus"
"github.com/mayswind/lab/pkg/core"
"github.com/mayswind/lab/pkg/settings"
"github.com/mayswind/ezbookkeeping/pkg/core"
"github.com/mayswind/ezbookkeeping/pkg/settings"
)
const logFieldRequestId = "REQUEST_ID"
+5 -5
View File
@@ -3,11 +3,11 @@ package middlewares
import (
"time"
"github.com/mayswind/lab/pkg/core"
"github.com/mayswind/lab/pkg/errs"
"github.com/mayswind/lab/pkg/log"
"github.com/mayswind/lab/pkg/services"
"github.com/mayswind/lab/pkg/utils"
"github.com/mayswind/ezbookkeeping/pkg/core"
"github.com/mayswind/ezbookkeeping/pkg/errs"
"github.com/mayswind/ezbookkeeping/pkg/log"
"github.com/mayswind/ezbookkeeping/pkg/services"
"github.com/mayswind/ezbookkeeping/pkg/utils"
)
const tokenQueryStringParam = "token"
+1 -1
View File
@@ -1,7 +1,7 @@
package middlewares
import (
"github.com/mayswind/lab/pkg/core"
"github.com/mayswind/ezbookkeeping/pkg/core"
)
const utcOffsetQueryStringParam = "utc_offset"
+4 -4
View File
@@ -6,10 +6,10 @@ import (
"io/ioutil"
"runtime"
"github.com/mayswind/lab/pkg/core"
"github.com/mayswind/lab/pkg/errs"
"github.com/mayswind/lab/pkg/log"
"github.com/mayswind/lab/pkg/utils"
"github.com/mayswind/ezbookkeeping/pkg/core"
"github.com/mayswind/ezbookkeeping/pkg/errs"
"github.com/mayswind/ezbookkeeping/pkg/log"
"github.com/mayswind/ezbookkeeping/pkg/utils"
)
var (
+3 -3
View File
@@ -1,9 +1,9 @@
package middlewares
import (
"github.com/mayswind/lab/pkg/core"
"github.com/mayswind/lab/pkg/requestid"
"github.com/mayswind/lab/pkg/settings"
"github.com/mayswind/ezbookkeeping/pkg/core"
"github.com/mayswind/ezbookkeeping/pkg/requestid"
"github.com/mayswind/ezbookkeeping/pkg/settings"
)
const requestIdHeader = "X-Request-ID"
+2 -2
View File
@@ -3,8 +3,8 @@ package middlewares
import (
"time"
"github.com/mayswind/lab/pkg/core"
"github.com/mayswind/lab/pkg/log"
"github.com/mayswind/ezbookkeeping/pkg/core"
"github.com/mayswind/ezbookkeeping/pkg/log"
)
// RequestLog logs the http request log
+3 -3
View File
@@ -4,11 +4,11 @@ import (
"fmt"
"strings"
"github.com/mayswind/lab/pkg/core"
"github.com/mayswind/lab/pkg/settings"
"github.com/mayswind/ezbookkeeping/pkg/core"
"github.com/mayswind/ezbookkeeping/pkg/settings"
)
const settingsCookieName = "lab_server_settings"
const settingsCookieName = "ebk_server_settings"
// ServerSettingsCookie adds server settings to cookies in response
func ServerSettingsCookie(config *settings.Config) core.MiddlewareHandlerFunc {
+1 -1
View File
@@ -1,6 +1,6 @@
package models
import "github.com/mayswind/lab/pkg/core"
import "github.com/mayswind/ezbookkeeping/pkg/core"
// TokenMaxUserAgentLength represents the maximum size of user agent stored in database
const TokenMaxUserAgentLength = 255
+2 -2
View File
@@ -5,8 +5,8 @@ import (
"strings"
"time"
"github.com/mayswind/lab/pkg/errs"
"github.com/mayswind/lab/pkg/utils"
"github.com/mayswind/ezbookkeeping/pkg/errs"
"github.com/mayswind/ezbookkeeping/pkg/utils"
)
// TransactionType represents transaction type
+1 -1
View File
@@ -3,7 +3,7 @@ package models
import (
"time"
"github.com/mayswind/lab/pkg/utils"
"github.com/mayswind/ezbookkeeping/pkg/utils"
)
// WeekDay represents week day
@@ -11,10 +11,10 @@ import (
"sync/atomic"
"time"
"github.com/mayswind/lab/pkg/errs"
"github.com/mayswind/lab/pkg/log"
"github.com/mayswind/lab/pkg/settings"
"github.com/mayswind/lab/pkg/utils"
"github.com/mayswind/ezbookkeeping/pkg/errs"
"github.com/mayswind/ezbookkeeping/pkg/log"
"github.com/mayswind/ezbookkeeping/pkg/settings"
"github.com/mayswind/ezbookkeeping/pkg/utils"
)
// Length and mask of all information in request id
@@ -5,7 +5,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/mayswind/lab/pkg/settings"
"github.com/mayswind/ezbookkeeping/pkg/settings"
)
func TestNewDefaultRequestIdGenerator_Http(t *testing.T) {
@@ -23,7 +23,7 @@ func TestNewDefaultRequestIdGenerator_Http(t *testing.T) {
}
func TestNewDefaultRequestIdGenerator_UnixSocket(t *testing.T) {
generator, _ := NewDefaultRequestIdGenerator(&settings.Config{HttpAddr: "1.2.3.4", UnixSocketPath: "/var/lib/labapp/lab.sock", Protocol: "socket", SecretKey: "secretkey"})
generator, _ := NewDefaultRequestIdGenerator(&settings.Config{HttpAddr: "1.2.3.4", UnixSocketPath: "/var/lib/ezbookkeeping/ezbookkeeping.sock", Protocol: "socket", SecretKey: "secretkey"})
requestId := generator.GenerateRequestId("127.0.0.1")
requestIdInfo := generator.parseRequestIdInfo(generator.parseRequestIdFromUuid(requestId))
@@ -31,13 +31,13 @@ func TestNewDefaultRequestIdGenerator_UnixSocket(t *testing.T) {
actualServerUniqId := requestIdInfo.ServerUniqId
assert.Equal(t, expectedServerUniqId, actualServerUniqId)
expectedInstanceUniqId := uint16(0x694b) // crc32("/var/lib/labapp/lab.sock" + "_" + "secretkey") & 0xFFFF
expectedInstanceUniqId := uint16(0x2cc) // crc32("/var/lib/ezbookkeeping/ezbookkeeping.sock" + "_" + "secretkey") & 0xFFFF
actualInstanceUniqId := requestIdInfo.InstanceUniqId
assert.Equal(t, expectedInstanceUniqId, actualInstanceUniqId)
}
func TestNewDefaultRequestIdGenerator_ClientIpv4(t *testing.T) {
generator, _ := NewDefaultRequestIdGenerator(&settings.Config{HttpAddr: "1.2.3.4", UnixSocketPath: "/var/lib/labapp/lab.sock", Protocol: "socket", SecretKey: "secretkey"})
generator, _ := NewDefaultRequestIdGenerator(&settings.Config{HttpAddr: "1.2.3.4", UnixSocketPath: "/var/lib/ezbookkeeping/ezbookkeeping.sock", Protocol: "socket", SecretKey: "secretkey"})
requestId := generator.GenerateRequestId("127.0.0.1")
requestIdInfo := generator.parseRequestIdInfo(generator.parseRequestIdFromUuid(requestId))
@@ -62,7 +62,7 @@ func TestNewDefaultRequestIdGenerator_ClientIpv4(t *testing.T) {
}
func TestNewDefaultRequestIdGenerator_ClientIpv6(t *testing.T) {
generator, _ := NewDefaultRequestIdGenerator(&settings.Config{HttpAddr: "1.2.3.4", UnixSocketPath: "/var/lib/labapp/lab.sock", Protocol: "socket", SecretKey: "secretkey"})
generator, _ := NewDefaultRequestIdGenerator(&settings.Config{HttpAddr: "1.2.3.4", UnixSocketPath: "/var/lib/ezbookkeeping/ezbookkeeping.sock", Protocol: "socket", SecretKey: "secretkey"})
requestId := generator.GenerateRequestId("2001:abc:def:1234::1")
requestIdInfo := generator.parseRequestIdInfo(generator.parseRequestIdFromUuid(requestId))
+1 -1
View File
@@ -1,7 +1,7 @@
package requestid
import (
"github.com/mayswind/lab/pkg/settings"
"github.com/mayswind/ezbookkeeping/pkg/settings"
)
// RequestIdContainer contains the current request id generator
+5 -5
View File
@@ -1,15 +1,15 @@
package services
import (
"github.com/mayswind/lab/pkg/utils"
"time"
"xorm.io/xorm"
"github.com/mayswind/lab/pkg/datastore"
"github.com/mayswind/lab/pkg/errs"
"github.com/mayswind/lab/pkg/models"
"github.com/mayswind/lab/pkg/uuid"
"github.com/mayswind/ezbookkeeping/pkg/datastore"
"github.com/mayswind/ezbookkeeping/pkg/errs"
"github.com/mayswind/ezbookkeeping/pkg/models"
"github.com/mayswind/ezbookkeeping/pkg/utils"
"github.com/mayswind/ezbookkeeping/pkg/uuid"
)
// AccountService represents account service
+3 -3
View File
@@ -1,9 +1,9 @@
package services
import (
"github.com/mayswind/lab/pkg/datastore"
"github.com/mayswind/lab/pkg/settings"
"github.com/mayswind/lab/pkg/uuid"
"github.com/mayswind/ezbookkeeping/pkg/datastore"
"github.com/mayswind/ezbookkeeping/pkg/settings"
"github.com/mayswind/ezbookkeeping/pkg/uuid"
)
// ServiceUsingDB represents a service that need to use db
+7 -7
View File
@@ -10,13 +10,13 @@ import (
"github.com/dgrijalva/jwt-go/request"
"xorm.io/xorm"
"github.com/mayswind/lab/pkg/core"
"github.com/mayswind/lab/pkg/datastore"
"github.com/mayswind/lab/pkg/errs"
"github.com/mayswind/lab/pkg/log"
"github.com/mayswind/lab/pkg/models"
"github.com/mayswind/lab/pkg/settings"
"github.com/mayswind/lab/pkg/utils"
"github.com/mayswind/ezbookkeeping/pkg/core"
"github.com/mayswind/ezbookkeeping/pkg/datastore"
"github.com/mayswind/ezbookkeeping/pkg/errs"
"github.com/mayswind/ezbookkeeping/pkg/log"
"github.com/mayswind/ezbookkeeping/pkg/models"
"github.com/mayswind/ezbookkeeping/pkg/settings"
"github.com/mayswind/ezbookkeeping/pkg/utils"
)
// TokenService represents user token service
+4 -4
View File
@@ -5,10 +5,10 @@ import (
"xorm.io/xorm"
"github.com/mayswind/lab/pkg/datastore"
"github.com/mayswind/lab/pkg/errs"
"github.com/mayswind/lab/pkg/models"
"github.com/mayswind/lab/pkg/uuid"
"github.com/mayswind/ezbookkeeping/pkg/datastore"
"github.com/mayswind/ezbookkeeping/pkg/errs"
"github.com/mayswind/ezbookkeeping/pkg/models"
"github.com/mayswind/ezbookkeeping/pkg/uuid"
)
// TransactionCategoryService represents transaction category service
+4 -4
View File
@@ -5,10 +5,10 @@ import (
"xorm.io/xorm"
"github.com/mayswind/lab/pkg/datastore"
"github.com/mayswind/lab/pkg/errs"
"github.com/mayswind/lab/pkg/models"
"github.com/mayswind/lab/pkg/uuid"
"github.com/mayswind/ezbookkeeping/pkg/datastore"
"github.com/mayswind/ezbookkeeping/pkg/errs"
"github.com/mayswind/ezbookkeeping/pkg/models"
"github.com/mayswind/ezbookkeeping/pkg/uuid"
)
// TransactionTagService represents transaction tag service
+5 -5
View File
@@ -7,11 +7,11 @@ import (
"xorm.io/xorm"
"github.com/mayswind/lab/pkg/datastore"
"github.com/mayswind/lab/pkg/errs"
"github.com/mayswind/lab/pkg/models"
"github.com/mayswind/lab/pkg/utils"
"github.com/mayswind/lab/pkg/uuid"
"github.com/mayswind/ezbookkeeping/pkg/datastore"
"github.com/mayswind/ezbookkeeping/pkg/errs"
"github.com/mayswind/ezbookkeeping/pkg/models"
"github.com/mayswind/ezbookkeeping/pkg/utils"
"github.com/mayswind/ezbookkeeping/pkg/uuid"
)
// TransactionService represents transaction service
+6 -6
View File
@@ -7,12 +7,12 @@ import (
"github.com/pquerna/otp/totp"
"xorm.io/xorm"
"github.com/mayswind/lab/pkg/datastore"
"github.com/mayswind/lab/pkg/errs"
"github.com/mayswind/lab/pkg/models"
"github.com/mayswind/lab/pkg/settings"
"github.com/mayswind/lab/pkg/utils"
"github.com/mayswind/lab/pkg/uuid"
"github.com/mayswind/ezbookkeeping/pkg/datastore"
"github.com/mayswind/ezbookkeeping/pkg/errs"
"github.com/mayswind/ezbookkeeping/pkg/models"
"github.com/mayswind/ezbookkeeping/pkg/settings"
"github.com/mayswind/ezbookkeeping/pkg/utils"
"github.com/mayswind/ezbookkeeping/pkg/uuid"
)
const (
+5 -5
View File
@@ -5,11 +5,11 @@ import (
"xorm.io/xorm"
"github.com/mayswind/lab/pkg/datastore"
"github.com/mayswind/lab/pkg/errs"
"github.com/mayswind/lab/pkg/models"
"github.com/mayswind/lab/pkg/utils"
"github.com/mayswind/lab/pkg/uuid"
"github.com/mayswind/ezbookkeeping/pkg/datastore"
"github.com/mayswind/ezbookkeeping/pkg/errs"
"github.com/mayswind/ezbookkeeping/pkg/models"
"github.com/mayswind/ezbookkeeping/pkg/utils"
"github.com/mayswind/ezbookkeeping/pkg/uuid"
)
// UserService represents user service
+9 -9
View File
@@ -10,13 +10,13 @@ import (
"gopkg.in/ini.v1"
"github.com/mayswind/lab/pkg/errs"
"github.com/mayswind/ezbookkeeping/pkg/errs"
)
const (
labWorkDirEnvName = "LAB_WORK_DIR"
labEnvNamePrefix = "LAB"
defaultConfigPath = "/conf/lab.ini"
ebkWorkDirEnvName = "EBK_WORK_DIR"
ebkEnvNamePrefix = "EBK"
defaultConfigPath = "/conf/ezbookkeeping.ini"
defaultStaticRootPath = "public"
)
@@ -72,14 +72,14 @@ const (
)
const (
defaultAppName string = "lab"
defaultAppName string = "ezBookkeeping"
defaultHttpAddr string = "0.0.0.0"
defaultHttpPort int = 8080
defaultDomain string = "localhost"
defaultDatabaseHost string = "127.0.0.1:3306"
defaultDatabaseName string = "lab"
defaultDatabaseName string = "ezbookkeeping"
defaultDatabaseMaxIdleConn int = 2
defaultDatabaseMaxOpenConn int = 0
defaultDatabaseConnMaxLifetime int = 14400
@@ -87,7 +87,7 @@ const (
defaultLogMode string = "console"
defaultLoglevel Level = LOGLEVEL_INFO
defaultSecretKey string = "lab"
defaultSecretKey string = "ezbookkeeping"
defaultTokenExpiredTime int = 604800 // 7 days
defaultTemporaryTokenExpiredTime int = 300 // 5 minutes
@@ -434,7 +434,7 @@ func loadExchangeRatesConfiguration(config *Config, configFile *ini.File, sectio
}
func getWorkingPath() (string, error) {
workingPath := os.Getenv(labWorkDirEnvName)
workingPath := os.Getenv(ebkWorkDirEnvName)
if workingPath != "" {
return workingPath, nil
@@ -513,7 +513,7 @@ func getConfigItemBoolValue(configFile *ini.File, sectionName string, itemName s
}
func getEnvironmentKey(sectionName string, itemName string) string {
return fmt.Sprintf("%s_%s_%s", labEnvNamePrefix, strings.ToUpper(sectionName), strings.ToUpper(itemName))
return fmt.Sprintf("%s_%s_%s", ebkEnvNamePrefix, strings.ToUpper(sectionName), strings.ToUpper(itemName))
}
func getLogLevel(logLevelStr string, defaultLogLevel Level) Level {
+2 -2
View File
@@ -7,8 +7,8 @@ import (
"github.com/gin-gonic/gin"
"github.com/go-playground/validator/v10"
"github.com/mayswind/lab/pkg/core"
"github.com/mayswind/lab/pkg/errs"
"github.com/mayswind/ezbookkeeping/pkg/core"
"github.com/mayswind/ezbookkeeping/pkg/errs"
)
// PrintJsonSuccessResult writes success response in json format to current http context
+1 -1
View File
@@ -4,7 +4,7 @@ import (
"bytes"
"net"
"github.com/mayswind/lab/pkg/errs"
"github.com/mayswind/ezbookkeeping/pkg/errs"
)
// GetLocalIPAddressesString returns all local ip address, every ip split by comma
+4 -3
View File
@@ -1,15 +1,16 @@
package utils
import (
"github.com/stretchr/testify/assert"
"testing"
"github.com/mayswind/lab/pkg/settings"
"github.com/stretchr/testify/assert"
"github.com/mayswind/ezbookkeeping/pkg/settings"
)
func TestClone(t *testing.T) {
expectedObject := &settings.Config{
AppName: "lab",
AppName: "ezbookkeeping",
Mode: settings.MODE_PRODUCTION,
DatabaseConfig: &settings.DatabaseConfig{
DatabaseType: settings.MySqlDbType,
+1 -1
View File
@@ -12,7 +12,7 @@ import (
"golang.org/x/crypto/pbkdf2"
"github.com/mayswind/lab/pkg/errs"
"github.com/mayswind/ezbookkeeping/pkg/errs"
)
const (
+1 -1
View File
@@ -4,7 +4,7 @@ import (
"sync/atomic"
"time"
"github.com/mayswind/lab/pkg/settings"
"github.com/mayswind/ezbookkeeping/pkg/settings"
)
// Length and mask of all information in uuid
+1 -1
View File
@@ -8,7 +8,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/mayswind/lab/pkg/settings"
"github.com/mayswind/ezbookkeeping/pkg/settings"
)
func TestGenerateUuid(t *testing.T) {
+2 -2
View File
@@ -1,8 +1,8 @@
package uuid
import (
"github.com/mayswind/lab/pkg/errs"
"github.com/mayswind/lab/pkg/settings"
"github.com/mayswind/ezbookkeeping/pkg/errs"
"github.com/mayswind/ezbookkeeping/pkg/settings"
)
// UuidContainer contains the current uuid generator
+1 -1
View File
@@ -3,7 +3,7 @@ package validators
import (
"github.com/go-playground/validator/v10"
"github.com/mayswind/lab/pkg/utils"
"github.com/mayswind/ezbookkeeping/pkg/utils"
)
// ValidEmail returns whether the given email is valid
+1 -1
View File
@@ -3,7 +3,7 @@ package validators
import (
"github.com/go-playground/validator/v10"
"github.com/mayswind/lab/pkg/utils"
"github.com/mayswind/ezbookkeeping/pkg/utils"
)
// ValidHexRGBColor returns whether the given hex reb color is valid
+1 -1
View File
@@ -3,7 +3,7 @@ package validators
import (
"github.com/go-playground/validator/v10"
"github.com/mayswind/lab/pkg/utils"
"github.com/mayswind/ezbookkeeping/pkg/utils"
)
// ValidUsername returns whether the given user name is valid
+1 -1
View File
@@ -4,7 +4,7 @@ import (
"fmt"
"strings"
"github.com/mayswind/lab/pkg/utils"
"github.com/mayswind/ezbookkeeping/pkg/utils"
)
var (