From 65fba7936c8272222104db767e6b3cec31f90ea3 Mon Sep 17 00:00:00 2001 From: Noah Hsu Date: Wed, 8 Jun 2022 16:42:06 +0800 Subject: [PATCH] chore: replace string with const --- internal/driver/addition.go | 1 + internal/driver/manage.go | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/internal/driver/addition.go b/internal/driver/addition.go index 041dd0dd..304ebdd2 100644 --- a/internal/driver/addition.go +++ b/internal/driver/addition.go @@ -9,6 +9,7 @@ const ( TypeSelect = "select" TypeBool = "bool" TypeText = "text" + TypeNumber = "number" ) type Item struct { diff --git a/internal/driver/manage.go b/internal/driver/manage.go index 2d971110..510f401f 100644 --- a/internal/driver/manage.go +++ b/internal/driver/manage.go @@ -27,46 +27,46 @@ func registerDriverItems(config Config, addition Additional) { func getMainItems(config Config) []Item { items := []Item{{ Name: "virtual_path", - Type: "string", + Type: TypeString, Required: true, Help: "", }, { Name: "index", - Type: "int", + Type: TypeNumber, Help: "use to sort", }, { Name: "down_proxy_url", - Type: "text", + Type: TypeText, }, { Name: "webdav_direct", - Type: "bool", + Type: TypeBool, Help: "Transfer the WebDAV of this account through the native without redirect", }} if !config.OnlyProxy && !config.OnlyLocal { items = append(items, []Item{{ Name: "web_proxy", - Type: "bool", + Type: TypeBool, }, { Name: "webdav_proxy", - Type: "bool", + Type: TypeBool, }, }...) } if config.LocalSort { items = append(items, []Item{{ Name: "order_by", - Type: "select", - Values: "name,size,updated_at", + Type: TypeSelect, + Values: "name,size,modified", }, { Name: "order_direction", - Type: "select", + Type: TypeSelect, Values: "ASC,DESC", }}...) } items = append(items, Item{ Name: "extract_folder", + Type: TypeSelect, Values: "front,back", - Type: "select", }) return items }