Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update the $RAW_EXT builder #174 #185

Merged
merged 1 commit into from
Jul 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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