fix: 将 libsql-client-go 作为普通目录提交,而非 gitlink

This commit is contained in:
2026-04-27 07:04:46 +08:00
parent 2359d6c9fa
commit f6332fbaaf
52 changed files with 42333 additions and 1 deletions

View File

@@ -0,0 +1,49 @@
package hrana
import (
"encoding/json"
"fmt"
"strconv"
)
type BatchResult struct {
StepResults []*StmtResult `json:"step_results"`
StepErrors []*Error `json:"step_errors"`
ReplicationIndex *uint64 `json:"replication_index"`
}
func (b *BatchResult) UnmarshalJSON(data []byte) error {
type Alias BatchResult
aux := &struct {
ReplicationIndex interface{} `json:"replication_index,omitempty"`
*Alias
}{
Alias: (*Alias)(b),
}
if err := json.Unmarshal(data, &aux); err != nil {
return err
}
if aux.ReplicationIndex == nil {
return nil
}
switch v := aux.ReplicationIndex.(type) {
case float64:
repIndex := uint64(v)
b.ReplicationIndex = &repIndex
case string:
if v == "" {
return nil
}
repIndex, err := strconv.ParseUint(v, 10, 64)
if err != nil {
return err
}
b.ReplicationIndex = &repIndex
default:
return fmt.Errorf("invalid type for replication index: %T", v)
}
return nil
}