mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-03-05 23:57:13 +08:00
# RAGFlow Go Implementation Plan 🚀 This repository tracks the progress of porting RAGFlow to Go. We'll implement core features and provide performance comparisons between Python and Go versions. ## Implementation Checklist - [x] User Management APIs - [x] Dataset Management Operations - [x] Retrieval Test - [x] Chat Management Operations - [x] Infinity Go SDK --------- Signed-off-by: Jin Hai <haijin.chn@gmail.com> Co-authored-by: Yingfeng Zhang <yingfeng.zhang@gmail.com>
80 lines
2.1 KiB
Go
80 lines
2.1 KiB
Go
//
|
|
// Copyright 2026 The InfiniFlow Authors. All Rights Reserved.
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
//
|
|
|
|
package model
|
|
|
|
import (
|
|
"database/sql/driver"
|
|
"encoding/json"
|
|
"time"
|
|
)
|
|
|
|
// BaseModel base model
|
|
type BaseModel struct {
|
|
CreateTime int64 `gorm:"column:create_time;index" json:"create_time"`
|
|
CreateDate *time.Time `gorm:"column:create_date;index" json:"create_date,omitempty"`
|
|
UpdateTime *int64 `gorm:"column:update_time;index" json:"update_time,omitempty"`
|
|
UpdateDate *time.Time `gorm:"column:update_date;index" json:"update_date,omitempty"`
|
|
}
|
|
|
|
// JSONMap is a map type that can store JSON data
|
|
type JSONMap map[string]interface{}
|
|
|
|
// Value implements driver.Valuer interface
|
|
func (j JSONMap) Value() (driver.Value, error) {
|
|
if j == nil {
|
|
return nil, nil
|
|
}
|
|
return json.Marshal(j)
|
|
}
|
|
|
|
// Scan implements sql.Scanner interface
|
|
func (j *JSONMap) Scan(value interface{}) error {
|
|
if value == nil {
|
|
*j = nil
|
|
return nil
|
|
}
|
|
b, ok := value.([]byte)
|
|
if !ok {
|
|
return json.Unmarshal([]byte(value.(string)), j)
|
|
}
|
|
return json.Unmarshal(b, j)
|
|
}
|
|
|
|
// JSONSlice is a slice type that can store JSON array data
|
|
type JSONSlice []interface{}
|
|
|
|
// Value implements driver.Valuer interface
|
|
func (j JSONSlice) Value() (driver.Value, error) {
|
|
if j == nil {
|
|
return nil, nil
|
|
}
|
|
return json.Marshal(j)
|
|
}
|
|
|
|
// Scan implements sql.Scanner interface
|
|
func (j *JSONSlice) Scan(value interface{}) error {
|
|
if value == nil {
|
|
*j = nil
|
|
return nil
|
|
}
|
|
b, ok := value.([]byte)
|
|
if !ok {
|
|
return json.Unmarshal([]byte(value.(string)), j)
|
|
}
|
|
return json.Unmarshal(b, j)
|
|
}
|