filecopy update (#208)
This commit is contained in:
+14
-47
@@ -90,11 +90,11 @@ release:
|
||||
mode: replace
|
||||
|
||||
# Docker 镜像配置
|
||||
# FIXME: 等待 goreleaser 2.12 更新后使用 dockers_v2
|
||||
dockers:
|
||||
# GitHub Container Registry
|
||||
- image_templates:
|
||||
- "ghcr.io/sjzar/chatlog:{{ .Tag }}-amd64"
|
||||
- "ghcr.io/sjzar/chatlog:latest-amd64"
|
||||
- "sjzar/chatlog:{{ .Tag }}-amd64"
|
||||
dockerfile: Dockerfile
|
||||
use: buildx
|
||||
goos: linux
|
||||
@@ -112,44 +112,7 @@ dockers:
|
||||
|
||||
- image_templates:
|
||||
- "ghcr.io/sjzar/chatlog:{{ .Tag }}-arm64"
|
||||
- "ghcr.io/sjzar/chatlog:latest-arm64"
|
||||
dockerfile: Dockerfile
|
||||
use: buildx
|
||||
goos: linux
|
||||
goarch: arm64
|
||||
build_flag_templates:
|
||||
- "--platform=linux/arm64"
|
||||
- "--label=org.opencontainers.image.title={{.ProjectName}}"
|
||||
- "--label=org.opencontainers.image.description=chat log tool, easily use your own chat data."
|
||||
- "--label=org.opencontainers.image.url=https://github.com/sjzar/chatlog"
|
||||
- "--label=org.opencontainers.image.source=https://github.com/sjzar/chatlog"
|
||||
- "--label=org.opencontainers.image.version={{.Version}}"
|
||||
- "--label=org.opencontainers.image.created={{.Date}}"
|
||||
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
|
||||
- "--label=org.opencontainers.image.licenses=Apache-2.0"
|
||||
|
||||
# Docker Hub
|
||||
- image_templates:
|
||||
- "sjzar/chatlog:{{ .Tag }}-amd64"
|
||||
- "sjzar/chatlog:latest-amd64"
|
||||
dockerfile: Dockerfile
|
||||
use: buildx
|
||||
goos: linux
|
||||
goarch: amd64
|
||||
build_flag_templates:
|
||||
- "--platform=linux/amd64"
|
||||
- "--label=org.opencontainers.image.title={{.ProjectName}}"
|
||||
- "--label=org.opencontainers.image.description=chat log tool, easily use your own chat data."
|
||||
- "--label=org.opencontainers.image.url=https://github.com/sjzar/chatlog"
|
||||
- "--label=org.opencontainers.image.source=https://github.com/sjzar/chatlog"
|
||||
- "--label=org.opencontainers.image.version={{.Version}}"
|
||||
- "--label=org.opencontainers.image.created={{.Date}}"
|
||||
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
|
||||
- "--label=org.opencontainers.image.licenses=Apache-2.0"
|
||||
|
||||
- image_templates:
|
||||
- "sjzar/chatlog:{{ .Tag }}-arm64"
|
||||
- "sjzar/chatlog:latest-arm64"
|
||||
dockerfile: Dockerfile
|
||||
use: buildx
|
||||
goos: linux
|
||||
@@ -172,17 +135,21 @@ docker_manifests:
|
||||
image_templates:
|
||||
- "ghcr.io/sjzar/chatlog:{{ .Tag }}-amd64"
|
||||
- "ghcr.io/sjzar/chatlog:{{ .Tag }}-arm64"
|
||||
- name_template: "ghcr.io/sjzar/chatlog:latest"
|
||||
image_templates:
|
||||
- "ghcr.io/sjzar/chatlog:latest-amd64"
|
||||
- "ghcr.io/sjzar/chatlog:latest-arm64"
|
||||
|
||||
|
||||
# Docker Hub manifests
|
||||
- name_template: "sjzar/chatlog:{{ .Tag }}"
|
||||
image_templates:
|
||||
- "sjzar/chatlog:{{ .Tag }}-amd64"
|
||||
- "sjzar/chatlog:{{ .Tag }}-arm64"
|
||||
- name_template: "sjzar/chatlog:latest"
|
||||
|
||||
# GitHub Container Registry latest
|
||||
- name_template: "{{ if not .Prerelease }}ghcr.io/sjzar/chatlog:latest{{ end }}"
|
||||
image_templates:
|
||||
- "sjzar/chatlog:latest-amd64"
|
||||
- "sjzar/chatlog:latest-arm64"
|
||||
- "ghcr.io/sjzar/chatlog:{{ .Tag }}-amd64"
|
||||
- "ghcr.io/sjzar/chatlog:{{ .Tag }}-arm64"
|
||||
|
||||
# Docker Hub latest
|
||||
- name_template: "{{ if not .Prerelease }}sjzar/chatlog:latest{{ end }}"
|
||||
image_templates:
|
||||
- "sjzar/chatlog:{{ .Tag }}-amd64"
|
||||
- "sjzar/chatlog:{{ .Tag }}-arm64"
|
||||
@@ -4,6 +4,7 @@ go 1.24.0
|
||||
|
||||
require (
|
||||
github.com/Eyevinn/mp4ff v0.49.0
|
||||
github.com/cespare/xxhash v1.1.0
|
||||
github.com/fsnotify/fsnotify v1.9.0
|
||||
github.com/gdamore/tcell/v2 v2.8.1
|
||||
github.com/gin-gonic/gin v1.10.1
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
github.com/Eyevinn/mp4ff v0.49.0 h1:00eRg5/KwcLGWUbv+hlifldf74qg46G1IxoWXHrgDvw=
|
||||
github.com/Eyevinn/mp4ff v0.49.0/go.mod h1:hJNUUqOBryLAzUW9wpCJyw2HaI+TCd2rUPhafoS5lgg=
|
||||
github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE=
|
||||
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
|
||||
github.com/bytedance/sonic v1.14.0 h1:/OfKt8HFw0kh2rj8N0F6C/qPGRESq0BbaNZgcNXXzQQ=
|
||||
github.com/bytedance/sonic v1.14.0/go.mod h1:WoEbx8WTcFJfzCe0hbmyTGrfjt8PzNEBdxlNUO24NhA=
|
||||
github.com/bytedance/sonic/loader v0.3.0 h1:dskwH8edlzNMctoruo8FPTJDF3vLtDT0sXZwvZJyqeA=
|
||||
github.com/bytedance/sonic/loader v0.3.0/go.mod h1:N8A3vUdtUebEY2/VQC0MyhYeKUFosQU6FxH2JmUe6VI=
|
||||
github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko=
|
||||
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
|
||||
github.com/cloudwego/base64x v0.1.6 h1:t11wG9AECkCDk5fMSoxmufanudBtJ+/HemLstXDLI2M=
|
||||
github.com/cloudwego/base64x v0.1.6/go.mod h1:OFcloc187FXDaYHvrNIjxSe8ncn0OOM8gEHfghB2IPU=
|
||||
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
|
||||
@@ -121,6 +125,8 @@ github.com/sjzar/go-silk v0.0.1 h1:cXD9dsIZti3n+g0Fd3IUvLH9A7tyL4jvUsHEyhff21s=
|
||||
github.com/sjzar/go-silk v0.0.1/go.mod h1:IXVcHEXKiU9j3ZtHEiGS37OFKkex9pdAhZVcFzAIOlM=
|
||||
github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 h1:+jumHNA0Wrelhe64i8F6HNlS8pkoyMv5sreGx2Ry5Rw=
|
||||
github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8/go.mod h1:3n1Cwaq1E1/1lhQhtRK2ts/ZwZEhjcQeJQ1RuC6Q/8U=
|
||||
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72 h1:qLC7fQah7D6K1B0ujays3HV9gkFtllcxhzImRR7ArPQ=
|
||||
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
|
||||
github.com/spf13/afero v1.14.0 h1:9tH6MapGnn/j0eb0yIXiLjERO8RB6xIVZRDCX7PtqWA=
|
||||
github.com/spf13/afero v1.14.0/go.mod h1:acJQ8t0ohCGuMN3O+Pv0V0hgMxNYDlvdk+VTfyZmbYo=
|
||||
github.com/spf13/cast v1.9.2 h1:SsGfm7M8QOFtEzumm7UZrZdLLquNdzFYfIbEXntcFbE=
|
||||
|
||||
@@ -2,6 +2,7 @@ package dbm
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"sync"
|
||||
"time"
|
||||
@@ -17,6 +18,7 @@ import (
|
||||
|
||||
type DBManager struct {
|
||||
path string
|
||||
id string
|
||||
fm *filemonitor.FileMonitor
|
||||
fgs map[string]*filemonitor.FileGroup
|
||||
dbs map[string]*sql.DB
|
||||
@@ -27,6 +29,7 @@ type DBManager struct {
|
||||
func NewDBManager(path string) *DBManager {
|
||||
return &DBManager{
|
||||
path: path,
|
||||
id: filepath.Base(path),
|
||||
fm: filemonitor.NewFileMonitor(),
|
||||
fgs: make(map[string]*filemonitor.FileGroup),
|
||||
dbs: make(map[string]*sql.DB),
|
||||
@@ -118,7 +121,7 @@ func (d *DBManager) OpenDB(path string) (*sql.DB, error) {
|
||||
var err error
|
||||
tempPath := path
|
||||
if runtime.GOOS == "windows" {
|
||||
tempPath, err = filecopy.GetTempCopy(path)
|
||||
tempPath, err = filecopy.GetTempCopy(d.id, path)
|
||||
if err != nil {
|
||||
log.Err(err).Msgf("获取临时拷贝文件 %s 失败", path)
|
||||
return nil, err
|
||||
|
||||
+855
-574
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user