chat_document.go
1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package domain
import (
"context"
"gitlab.fjmaimaimai.com/allied-creation/su-micro/pkg/transaction"
)
type ChatDocument struct {
Id int64 // 唯一标识
Name string // 文件命
FileType string // 文件类型 markdown\pdf\txt\doc&docx
Status int // 1.使用中、0.待处理、2.预处理中、3.处理失败
Metadata DocumentMetadata
CreatedAt int64 `json:",omitempty"`
UpdatedAt int64 `json:",omitempty"`
DeletedAt int64 `json:",omitempty"`
Version int `json:",omitempty"`
}
const (
Enable = 1
Disable = 2
)
const (
StatusInUsed = 1
StatusWaitProcess = 0
StatusPreProcess = 2
StatusProcessFail = 3
)
type DocumentMetadata struct {
OriginFileName string `json:",omitempty"` // 源文件命
Ext string `json:",omitempty"` // 格式
FileId string `json:",omitempty"` // 星火文件ID
FileUrl string `json:",omitempty"` // 文件地址
FileSize float64 `json:",omitempty"` // 文件大小
}
type ChatDocumentRepository interface {
Insert(ctx context.Context, conn transaction.Conn, dm *ChatDocument) (*ChatDocument, error)
Update(ctx context.Context, conn transaction.Conn, dm *ChatDocument) (*ChatDocument, error)
UpdateWithVersion(ctx context.Context, conn transaction.Conn, dm *ChatDocument) (*ChatDocument, error)
Delete(ctx context.Context, conn transaction.Conn, dm *ChatDocument) (*ChatDocument, error)
FindOne(ctx context.Context, conn transaction.Conn, id int64) (*ChatDocument, error)
FindOneUnscoped(ctx context.Context, conn transaction.Conn, id int64) (*ChatDocument, error)
Find(ctx context.Context, conn transaction.Conn, queryOptions map[string]interface{}) (int64, []*ChatDocument, error)
}