Skip to content

Commit

Permalink
fix: update the $RAW_EXT builder #174 (#185)
Browse files Browse the repository at this point in the history
Signed-off-by: saltbo <saltbo@foxmail.com>
  • Loading branch information
saltbo authored Jul 30, 2023
1 parent 668bd01 commit 5771c78
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion internal/app/entity/matter_env.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"path/filepath"
"strconv"
"strings"
"time"

"github.com/google/uuid"
Expand All @@ -28,7 +29,7 @@ var SupportEnvs = []MatterEnv{
{Name: "$UUID", Intro: "UUID", Example: "6ba7b810-9dad-11d1-80b4-00c04fd430c8", builder: func(m *Matter) string { return uuid.New().String() }},
{Name: "$RAW_PATH", Intro: "初始上传路径", Example: "文稿/简历", builder: func(m *Matter) string { return m.Parent }},
{Name: "$RAW_NAME", Intro: "初始文件名", Example: "张三-简历", builder: func(m *Matter) string { return m.Name }},
{Name: "$RAW_EXT", Intro: "初始文件后缀", Example: "pdf", builder: func(m *Matter) string { return filepath.Ext(m.Name)[1:] }},
{Name: "$RAW_EXT", Intro: "初始文件后缀", Example: "pdf", builder: func(m *Matter) string { return strings.TrimPrefix(filepath.Ext(m.Name), ".") }},
{Name: "$RAND_8KEY", Intro: "8位随机字符", Example: "mCUoR35r", builder: func(m *Matter) string { return strutil.RandomText(8) }},
{Name: "$RAND_16KEY", Intro: "16位随机字符", Example: "e1CbDUNfyVP3sScJ", builder: func(m *Matter) string { return strutil.RandomText(16) }},
{Name: "$NOW_DATE", Intro: "当前时间-日期", Example: "20210101", builder: func(m *Matter) string { return timeutil.Format(time.Now(), "YYYYMMDD") }},
Expand Down

0 comments on commit 5771c78

Please sign in to comment.