github.com/easysoft/zendata@v0.0.0-20240513203326-705bd5a7fd67/internal/pkg/const/const.go (about)

     1  package consts
     2  
     3  import (
     4  	"fmt"
     5  	"os"
     6  	"os/user"
     7  )
     8  
     9  const (
    10  	AppName = "zd"
    11  )
    12  
    13  var (
    14  	ApiPath = "/"
    15  	WsPath  = "ws"
    16  
    17  	PthSep = string(os.PathSeparator)
    18  
    19  	ConfigVer      = 1.0
    20  	userProfile, _ = user.Current()
    21  
    22  	LanguageDefault = "en"
    23  	LanguageEN      = "en"
    24  	LanguageZH      = "zh"
    25  
    26  	CachePrefix  = "cache_"
    27  	CachePostfix = "_is_num"
    28  	EnRes        = fmt.Sprintf("res/en/messages.json")
    29  	ZhRes        = fmt.Sprintf("res/zh/messages.json")
    30  
    31  	Localhost = "localhost"
    32  
    33  	LeftWidth = 36
    34  	MinWidth  = 130
    35  	MinHeight = 36
    36  
    37  	CmdViewHeight = 10
    38  
    39  	MaxNumb         = 100000
    40  	MaxNumbForAsync = 100
    41  
    42  	FormatText  = "txt"
    43  	FormatJson  = "json"
    44  	FormatXml   = "xml"
    45  	FormatSql   = "sql"
    46  	FormatExcel = "xlsx"
    47  	FormatCsv   = "csv"
    48  	FormatProto = "proto"
    49  	FormatData  = "data"
    50  	Formats     = []string{FormatText, FormatJson, FormatXml, FormatSql, FormatExcel, FormatCsv, FormatProto}
    51  
    52  	ModeParallel       = "parallel"
    53  	ModeRecursive      = "recursive"
    54  	ModeParallelShort  = "p"
    55  	ModeRecursiveShort = "r"
    56  	Modes              = []string{ModeParallel, ModeRecursive, ModeParallelShort, ModeRecursiveShort}
    57  
    58  	DefTypeText    = "text"
    59  	DefTypeArticle = "article"
    60  	DefTypeImage   = "image"
    61  	DefTypeVoice   = "voice"
    62  	DefTypeVideo   = "video"
    63  
    64  	FieldTypeList      = "list"
    65  	FieldTypeTimestamp = "timestamp"
    66  	FieldTypeUlid      = "ulid"
    67  	FieldTypeArticle   = "article"
    68  
    69  	LeftBrackets  rune = '('
    70  	RightBrackets rune = ')'
    71  	Backtick      rune = '`'
    72  
    73  	DefaultDataServicePort = 8848
    74  	DefaultRoot            = "./"
    75  	DefaultNumber          = 10
    76  
    77  	ResDirData  = "data"
    78  	ResDirYaml  = "yaml"
    79  	ResDirUsers = "users"
    80  	ResKeys     = []string{ResDirData, ResDirYaml, ResDirUsers}
    81  
    82  	ResTypeDef       = "def" // only used for refer type
    83  	ResTypeConfig    = "config"
    84  	ResTypeRanges    = "ranges"
    85  	ResTypeInstances = "instances"
    86  	ResTypeYaml      = "yaml"
    87  	ResTypeExcel     = "excel"
    88  	ResTypeText      = "text"
    89  	ResTypeValue     = "value"
    90  	ResTypes         = []string{ResTypeConfig, ResTypeRanges, ResTypeInstances, ResTypeExcel, ResTypeText, ResTypeValue}
    91  
    92  	TmpDir = "tmp/"
    93  
    94  	SqliteDriver = "sqlite3"
    95  	SqliteFile   = "file:" + TmpDir + "cache/.data.db"
    96  
    97  	SqliteTrackTable = "zd_excel"
    98  
    99  	ExcelBorder = `{"border": [{"type":"left","color":"999999","style":1}, {"type":"top","color":"999999","style":1},
   100  		                              {"type":"bottom","color":"999999","style":1}, {"type":"right","color":"999999","style":1}]}`
   101  	ExcelHeader = `{"fill":{"type":"pattern","pattern":1,"color":["E0EBF5"]}}`
   102  
   103  	TablePrefix = "zd_"
   104  	PageSize    = 15
   105  
   106  	// database type  [added by leo 2022/05/10]
   107  	DBTypeMysql     = "mysql"
   108  	DBTypeSqlServer = "sqlserver"
   109  	DBTypeOracle    = "oracle"
   110  
   111  	Na = "N/A"
   112  )