Konstantin Lebedev
3 years ago
10 changed files with 252 additions and 378 deletions
-
12go.mod
-
19go.sum
-
1weed/command/imports.go
-
11weed/command/scaffold/filer.toml
-
16weed/filer/ydb/readme.md
-
195weed/filer/ydb/ydb_store.go
-
76weed/filer/ydb/ydb_store_kv.go
-
13weed/filer/ydb/ydb_types.go
-
194weed/filer/ydb/ydb_types_ydbgen.go
-
1weed/server/filer_server.go
@ -1,194 +0,0 @@ |
|||
// Code generated by ydbgen; DO NOT EDIT.
|
|||
|
|||
package ydb |
|||
|
|||
import ( |
|||
"strconv" |
|||
|
|||
"github.com/yandex-cloud/ydb-go-sdk/v2" |
|||
"github.com/yandex-cloud/ydb-go-sdk/v2/table" |
|||
) |
|||
|
|||
var ( |
|||
_ = strconv.Itoa |
|||
_ = ydb.StringValue |
|||
_ = table.NewQueryParameters |
|||
) |
|||
|
|||
func (f *FileMeta) Scan(res *table.Result) (err error) { |
|||
res.SeekItem("dir_hash") |
|||
f.DirHash = res.Int64() |
|||
|
|||
res.SeekItem("name") |
|||
f.Name = res.UTF8() |
|||
|
|||
res.SeekItem("directory") |
|||
f.Directory = res.UTF8() |
|||
|
|||
return res.Err() |
|||
} |
|||
|
|||
func (f *FileMeta) QueryParameters() *table.QueryParameters { |
|||
var v0 ydb.Value |
|||
{ |
|||
vp0 := ydb.Int64Value(f.DirHash) |
|||
v0 = vp0 |
|||
} |
|||
var v1 ydb.Value |
|||
{ |
|||
vp0 := ydb.UTF8Value(f.Name) |
|||
v1 = vp0 |
|||
} |
|||
var v2 ydb.Value |
|||
{ |
|||
vp0 := ydb.UTF8Value(f.Directory) |
|||
v2 = vp0 |
|||
} |
|||
return table.NewQueryParameters( |
|||
table.ValueParam("$dir_hash", v0), |
|||
table.ValueParam("$name", v1), |
|||
table.ValueParam("$directory", v2), |
|||
) |
|||
} |
|||
|
|||
func (f *FileMeta) StructValue() ydb.Value { |
|||
var v0 ydb.Value |
|||
{ |
|||
var v1 ydb.Value |
|||
{ |
|||
vp0 := ydb.Int64Value(f.DirHash) |
|||
v1 = vp0 |
|||
} |
|||
var v2 ydb.Value |
|||
{ |
|||
vp0 := ydb.UTF8Value(f.Name) |
|||
v2 = vp0 |
|||
} |
|||
var v3 ydb.Value |
|||
{ |
|||
vp0 := ydb.UTF8Value(f.Directory) |
|||
v3 = vp0 |
|||
} |
|||
v0 = ydb.StructValue( |
|||
ydb.StructFieldValue("dir_hash", v1), |
|||
ydb.StructFieldValue("name", v2), |
|||
ydb.StructFieldValue("directory", v3), |
|||
) |
|||
} |
|||
return v0 |
|||
} |
|||
|
|||
func (f *FileMeta) StructType() ydb.Type { |
|||
var t0 ydb.Type |
|||
{ |
|||
fs0 := make([]ydb.StructOption, 3) |
|||
var t1 ydb.Type |
|||
{ |
|||
tp0 := ydb.TypeInt64 |
|||
t1 = tp0 |
|||
} |
|||
fs0[0] = ydb.StructField("dir_hash", t1) |
|||
var t2 ydb.Type |
|||
{ |
|||
tp0 := ydb.TypeUTF8 |
|||
t2 = tp0 |
|||
} |
|||
fs0[1] = ydb.StructField("name", t2) |
|||
var t3 ydb.Type |
|||
{ |
|||
tp0 := ydb.TypeUTF8 |
|||
t3 = tp0 |
|||
} |
|||
fs0[2] = ydb.StructField("directory", t3) |
|||
t0 = ydb.Struct(fs0...) |
|||
} |
|||
return t0 |
|||
} |
|||
|
|||
func (fs *FileMetas) Scan(res *table.Result) (err error) { |
|||
for res.NextRow() { |
|||
var x0 FileMeta |
|||
res.SeekItem("dir_hash") |
|||
x0.DirHash = res.Int64() |
|||
|
|||
res.SeekItem("name") |
|||
x0.Name = res.UTF8() |
|||
|
|||
res.SeekItem("directory") |
|||
x0.Directory = res.UTF8() |
|||
|
|||
if res.Err() == nil { |
|||
*fs = append(*fs, x0) |
|||
} |
|||
} |
|||
return res.Err() |
|||
} |
|||
|
|||
func (fs FileMetas) ListValue() ydb.Value { |
|||
var list0 ydb.Value |
|||
vs0 := make([]ydb.Value, len(fs)) |
|||
for i0, item0 := range fs { |
|||
var v0 ydb.Value |
|||
{ |
|||
var v1 ydb.Value |
|||
{ |
|||
var v2 ydb.Value |
|||
{ |
|||
vp0 := ydb.Int64Value(item0.DirHash) |
|||
v2 = vp0 |
|||
} |
|||
var v3 ydb.Value |
|||
{ |
|||
vp0 := ydb.UTF8Value(item0.Name) |
|||
v3 = vp0 |
|||
} |
|||
var v4 ydb.Value |
|||
{ |
|||
vp0 := ydb.UTF8Value(item0.Directory) |
|||
v4 = vp0 |
|||
} |
|||
v1 = ydb.StructValue( |
|||
ydb.StructFieldValue("dir_hash", v2), |
|||
ydb.StructFieldValue("name", v3), |
|||
ydb.StructFieldValue("directory", v4), |
|||
) |
|||
} |
|||
v0 = v1 |
|||
} |
|||
vs0[i0] = v0 |
|||
} |
|||
if len(vs0) == 0 { |
|||
var t1 ydb.Type |
|||
{ |
|||
var t2 ydb.Type |
|||
{ |
|||
fs0 := make([]ydb.StructOption, 3) |
|||
var t3 ydb.Type |
|||
{ |
|||
tp0 := ydb.TypeInt64 |
|||
t3 = tp0 |
|||
} |
|||
fs0[0] = ydb.StructField("dir_hash", t3) |
|||
var t4 ydb.Type |
|||
{ |
|||
tp0 := ydb.TypeUTF8 |
|||
t4 = tp0 |
|||
} |
|||
fs0[1] = ydb.StructField("name", t4) |
|||
var t5 ydb.Type |
|||
{ |
|||
tp0 := ydb.TypeUTF8 |
|||
t5 = tp0 |
|||
} |
|||
fs0[2] = ydb.StructField("directory", t5) |
|||
t2 = ydb.Struct(fs0...) |
|||
} |
|||
t1 = t2 |
|||
} |
|||
t0 := ydb.List(t1) |
|||
list0 = ydb.ZeroValue(t0) |
|||
} else { |
|||
list0 = ydb.ListValue(vs0...) |
|||
} |
|||
return list0 |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue