From 32bc79185b1fa69f4ce0f60c81259cf8be9fd1d8 Mon Sep 17 00:00:00 2001 From: Artem Murashko Date: Sat, 19 Oct 2024 20:07:23 +0300 Subject: [PATCH 01/28] add skeleton --- database/ydb/ydb.go | 100 ++++++++++++++++++++++++++++++++++++++++++++ go.mod | 35 +++++++++------- go.sum | 62 +++++++++++++++++++++++++++ 3 files changed, 181 insertions(+), 16 deletions(-) create mode 100644 database/ydb/ydb.go diff --git a/database/ydb/ydb.go b/database/ydb/ydb.go new file mode 100644 index 000000000..68621df5f --- /dev/null +++ b/database/ydb/ydb.go @@ -0,0 +1,100 @@ +package ydb + +import ( + "context" + "fmt" + "io" + "sync/atomic" + + "github.com/ydb-platform/ydb-go-sdk/v3" + + "github.com/golang-migrate/migrate/v4/database" +) + +func init() { + db := YDB{} + database.Register("ydb", &db) +} + +const DefaultMigrationsTable = "schema_migrations" + +var ( + ErrDatabaseDirty = fmt.Errorf("database is dirty") + ErrNilConfig = fmt.Errorf("no config") + ErrNoDatabaseName = fmt.Errorf("no database name") +) + +type Config struct { + MigrationsTable string +} + +type YDB struct { + driver *ydb.Driver + config *Config + + isLocked atomic.Bool +} + +func WithInstance(driver *ydb.Driver, config *Config) (database.Driver, error) { + if config == nil { + return nil, ErrNilConfig + } + + if len(config.MigrationsTable) == 0 { + config.MigrationsTable = DefaultMigrationsTable + } + + db := &YDB{ + driver: driver, + config: config, + } + err := db.ensureVersionTable() + if err != nil { + return nil, err + } + + return db, nil +} + +func (db *YDB) Open(url string) (database.Driver, error) { + return nil, nil +} + +func (db *YDB) Close() error { + return db.driver.Close(context.Background()) +} + +func (db *YDB) Run(migration io.Reader) error { + return nil +} + +func (db *YDB) SetVersion(version int, dirty bool) error { + return nil +} + +func (db *YDB) Version() (version int, dirty bool, err error) { + return +} + +func (db *YDB) Drop() error { + return nil +} + +func (db *YDB) Lock() error { + if !db.isLocked.CompareAndSwap(false, true) { + return database.ErrLocked + } + return nil +} + +func (db *YDB) Unlock() error { + if !db.isLocked.CompareAndSwap(true, false) { + return database.ErrNotLocked + } + return nil +} + +// ensureVersionTable checks if versions table exists and, if not, creates it. +func (db *YDB) ensureVersionTable() (err error) { + return nil +} diff --git a/go.mod b/go.mod index 851054ffd..507babb77 100644 --- a/go.mod +++ b/go.mod @@ -38,7 +38,7 @@ require ( github.com/xanzy/go-gitlab v0.15.0 go.mongodb.org/mongo-driver v1.7.5 go.uber.org/atomic v1.7.0 - golang.org/x/oauth2 v0.18.0 + golang.org/x/oauth2 v0.22.0 golang.org/x/tools v0.24.0 google.golang.org/api v0.169.0 modernc.org/ql v1.0.0 @@ -51,6 +51,7 @@ require ( github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/jackc/puddle/v2 v2.2.1 // indirect + github.com/jonboulle/clockwork v0.4.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/kr/text v0.2.0 // indirect github.com/moby/docker-image-spec v1.3.1 // indirect @@ -58,6 +59,8 @@ require ( github.com/modern-go/reflect2 v1.0.2 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect github.com/stretchr/objx v0.5.2 // indirect + github.com/ydb-platform/ydb-go-genproto v0.0.0-20241002120727-5acc94bcb119 // indirect + github.com/ydb-platform/ydb-go-sdk/v3 v3.84.1 // indirect go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0 // indirect go.opentelemetry.io/otel v1.29.0 // indirect @@ -71,7 +74,7 @@ require ( require ( cloud.google.com/go v0.112.1 // indirect cloud.google.com/go/compute v1.25.1 // indirect - cloud.google.com/go/compute/metadata v0.2.3 // indirect + cloud.google.com/go/compute/metadata v0.5.0 // indirect cloud.google.com/go/iam v1.1.6 // indirect cloud.google.com/go/longrunning v0.5.5 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect @@ -102,24 +105,24 @@ require ( github.com/aws/aws-sdk-go-v2/service/s3 v1.27.11 // indirect github.com/aws/smithy-go v1.13.3 // indirect github.com/census-instrumentation/opencensus-proto v0.4.1 // indirect - github.com/cespare/xxhash/v2 v2.2.0 // indirect + github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/cloudflare/golz4 v0.0.0-20150217214814-ef862a3cdc58 // indirect - github.com/cncf/xds/go v0.0.0-20240318125728-8a4994d93e50 // indirect + github.com/cncf/xds/go v0.0.0-20240723142845-024c85f92f20 // indirect github.com/cznic/mathutil v0.0.0-20180504122225-ca4c9f2c1369 // indirect github.com/danieljoos/wincred v1.1.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/docker/go-units v0.5.0 // indirect github.com/dvsekhvalnov/jose2go v1.6.0 // indirect github.com/edsrzf/mmap-go v0.0.0-20170320065105-0bce6a688712 // indirect - github.com/envoyproxy/go-control-plane v0.12.0 // indirect - github.com/envoyproxy/protoc-gen-validate v1.0.4 // indirect + github.com/envoyproxy/go-control-plane v0.13.0 // indirect + github.com/envoyproxy/protoc-gen-validate v1.1.0 // indirect github.com/form3tech-oss/jwt-go v3.2.5+incompatible // indirect github.com/gabriel-vasile/mimetype v1.4.1 // indirect github.com/go-stack/stack v1.8.0 // indirect github.com/goccy/go-json v0.9.11 // indirect github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect github.com/gogo/protobuf v1.3.2 // indirect - github.com/golang-jwt/jwt/v4 v4.4.2 // indirect + github.com/golang-jwt/jwt/v4 v4.5.0 // indirect github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe // indirect github.com/golang-sql/sqlexp v0.1.0 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect @@ -176,22 +179,22 @@ require ( github.com/zeebo/xxh3 v1.0.2 // indirect gitlab.com/nyarla/go-crypt v0.0.0-20160106005555-d9a5dc2b789b // indirect go.opencensus.io v0.24.0 // indirect - golang.org/x/crypto v0.27.0 // indirect + golang.org/x/crypto v0.28.0 // indirect golang.org/x/exp v0.0.0-20230315142452-642cacee5cc0 // indirect golang.org/x/mod v0.21.0 // indirect - golang.org/x/net v0.29.0 // indirect + golang.org/x/net v0.30.0 // indirect golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/term v0.24.0 // indirect - golang.org/x/text v0.18.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/term v0.25.0 // indirect + golang.org/x/text v0.19.0 // indirect golang.org/x/time v0.5.0 // indirect golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect google.golang.org/appengine v1.6.8 // indirect google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240513163218-0867130af1f8 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240513163218-0867130af1f8 // indirect - google.golang.org/grpc v1.64.1 // indirect - google.golang.org/protobuf v1.34.2 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20241015192408-796eee8c2d53 // indirect + google.golang.org/grpc v1.67.1 // indirect + google.golang.org/protobuf v1.35.1 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect lukechampine.com/uint128 v1.2.0 // indirect diff --git a/go.sum b/go.sum index 846e435b8..f55f7b244 100644 --- a/go.sum +++ b/go.sum @@ -14,6 +14,8 @@ cloud.google.com/go/compute v1.25.1 h1:ZRpHJedLtTpKgr3RV1Fx23NuaAEN1Zfx9hw1u4aJd cloud.google.com/go/compute v1.25.1/go.mod h1:oopOIR53ly6viBYxaDhBfJwzUAxf1zE//uf3IB011ls= cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= +cloud.google.com/go/compute/metadata v0.5.0 h1:Zr0eK8JbFv6+Wi4ilXAR8FJ3wyNdpxHKJNPos6LTZOY= +cloud.google.com/go/compute/metadata v0.5.0/go.mod h1:aHnloV2TPI38yx4s9+wAZhHykWvVCfu7hQbF+9CWoiY= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/iam v1.1.6 h1:bEa06k05IO4f4uJonbB5iAgKTPpABy1ayxaIZV/GHVc= cloud.google.com/go/iam v1.1.6/go.mod h1:O0zxdPeGBoFdWW3HWmBxJsk0pfvNM/p/qa82rWOGTwI= @@ -71,6 +73,7 @@ github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERo github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= github.com/andybalholm/brotli v1.0.4 h1:V7DdXeJtZscaqfNuAdSRuRFzuiKlHSC/Zh3zl9qY3JY= github.com/andybalholm/brotli v1.0.4/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= +github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/apache/arrow/go/v10 v10.0.1 h1:n9dERvixoC/1JjDmBcs9FPaEryoANa2sCgVFo6ez9cI= github.com/apache/arrow/go/v10 v10.0.1/go.mod h1:YvhnlEePVnBS4+0z3fhPfUy7W1Ikj0Ih0vcRo/gZ1M0= github.com/apache/thrift v0.16.0 h1:qEy6UW60iVOlUy+b9ZR0d5WzUWYGOo4HfopoyBaNmoY= @@ -126,14 +129,24 @@ github.com/cenkalti/backoff/v4 v4.1.2/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInq github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/census-instrumentation/opencensus-proto v0.4.1 h1:iKLQ0xPNFxR/2hzXZMrBo8f1j86j5WHzznCCQxV/b8g= github.com/census-instrumentation/opencensus-proto v0.4.1/go.mod h1:4T9NM4+4Vw91VeyqjLS6ao50K5bOcLKN6Q42XnYaRYw= +github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= +github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cloudflare/golz4 v0.0.0-20150217214814-ef862a3cdc58 h1:F1EaeKL/ta07PY/k9Os/UFtwERei2/XzGemhpGnBKNg= github.com/cloudflare/golz4 v0.0.0-20150217214814-ef862a3cdc58/go.mod h1:EOBUe0h4xcZ5GoxqC5SDxFQ8gwyZPKQoEzownBlhI80= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= +github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20240318125728-8a4994d93e50 h1:DBmgJDC9dTfkVyGgipamEh2BpGYxScCH1TOF1LL1cXc= github.com/cncf/xds/go v0.0.0-20240318125728-8a4994d93e50/go.mod h1:5e1+Vvlzido69INQaVO6d87Qn543Xr6nooe9Kz7oBFM= +github.com/cncf/xds/go v0.0.0-20240723142845-024c85f92f20 h1:N+3sFI5GUjRKBi+i0TxYVST9h4Ie192jJWpHvthBBgg= +github.com/cncf/xds/go v0.0.0-20240723142845-024c85f92f20/go.mod h1:W+zGtBO5Y1IgJhy4+A9GOqVhqLpfZi+vwmdNXUehLA8= github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I= github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= github.com/cockroachdb/cockroach-go/v2 v2.1.1 h1:3XzfSMuUT0wBe1a3o5C0eOTcArhmmFAg2Jzh/7hhKqo= @@ -175,11 +188,17 @@ github.com/edsrzf/mmap-go v0.0.0-20170320065105-0bce6a688712/go.mod h1:YO35OhQPt github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= github.com/envoyproxy/go-control-plane v0.12.0 h1:4X+VP1GHd1Mhj6IB5mMeGbLCleqxjletLK6K0rbxyZI= github.com/envoyproxy/go-control-plane v0.12.0/go.mod h1:ZBTaoJ23lqITozF0M6G4/IragXCQKCnYbmlmtHvwRG0= +github.com/envoyproxy/go-control-plane v0.13.0 h1:HzkeUz1Knt+3bK+8LG1bxOO/jzWZmdxpwC51i202les= +github.com/envoyproxy/go-control-plane v0.13.0/go.mod h1:GRaKG3dwvFoTg4nj7aXdZnvMg4d7nvT/wl9WgVXn3Q8= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/envoyproxy/protoc-gen-validate v1.0.4 h1:gVPz/FMfvh57HdSJQyvBtF00j8JU4zdyUgIUNhlgg0A= github.com/envoyproxy/protoc-gen-validate v1.0.4/go.mod h1:qys6tmnRsYrQqIhm2bvKZH4Blx/1gTIZ2UKVY1M+Yew= +github.com/envoyproxy/protoc-gen-validate v1.1.0 h1:tntQDh69XqOCOZsDz0lVJQez/2L6Uu2PdjCQwWCJ3bM= +github.com/envoyproxy/protoc-gen-validate v1.1.0/go.mod h1:sXRDRVmzEbkM7CVcM06s9shE/m23dg3wzjl0UWqJ2q4= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/form3tech-oss/jwt-go v3.2.5+incompatible h1:/l4kBbb4/vGSsdtB5nUe8L7B9mImVMaBPw9L/0TBHU8= @@ -191,6 +210,7 @@ github.com/fsouza/fake-gcs-server v1.17.0 h1:OeH75kBZcZa3ZE+zz/mFdJ2btt9FgqfjI7g github.com/fsouza/fake-gcs-server v1.17.0/go.mod h1:D1rTE4YCyHFNa99oyJJ5HyclvN/0uQR+pM/VdlL83bw= github.com/gabriel-vasile/mimetype v1.4.1 h1:TRWk7se+TOjCYgRth7+1/OYLNiRNIotknkFtf/dnN7Q= github.com/gabriel-vasile/mimetype v1.4.1/go.mod h1:05Vi0w3Y9c/lNvJOdmIwvrrAhX3rYhfQQCaf9VJcv7M= +github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= @@ -222,6 +242,8 @@ github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69 github.com/golang-jwt/jwt/v4 v4.0.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= github.com/golang-jwt/jwt/v4 v4.4.2 h1:rcc4lwaZgFMCZ5jxF9ABolDcIHdBytAFgqFPbSJQAYs= github.com/golang-jwt/jwt/v4 v4.4.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= +github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= +github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe h1:lXe2qZdvpiX5WZkZR4hgp4KJVfY3nMkvmwbVkpv1rVY= github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0= github.com/golang-sql/sqlexp v0.1.0 h1:ZCD6MBpcuOVfGVqsEmY5/4FtYiKz6tSyUv9LPEDei6A= @@ -241,6 +263,7 @@ github.com/golang/protobuf v1.0.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5y github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= @@ -306,6 +329,7 @@ github.com/gorilla/mux v1.7.4 h1:VuZ8uybHlWmqV03+zRzdwKL4tUnIp1MAQtp1mIFE1bc= github.com/gorilla/mux v1.7.4/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4= github.com/gorilla/sessions v1.2.1/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/zI+bUmuGM= +github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 h1:bkypFPDjIYGfCYD5mRBvpqxfYX1YCS1PXdKYWi8FsN0= github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0/go.mod h1:P+Lt/0by1T8bfcF3z737NnSbmxQAppXMRziHUxPOC8k= github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c h1:6rhixN/i8ZofjG1Y75iExal34USq5p+wiN1tpie8IrU= @@ -403,6 +427,8 @@ github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGw github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= github.com/jmoiron/sqlx v1.2.0/go.mod h1:1FEQNm3xlJgrMD+FBdI9+xvCksHtbpVBBw5dYhBSsks= github.com/jmoiron/sqlx v1.3.1/go.mod h1:2BljVx/86SuTyjE+aPYlHCTNvZrnJXghYGpNiXLBMCQ= +github.com/jonboulle/clockwork v0.4.0 h1:p4Cf1aMWXnXAUh8lVfewRBx1zaTSYKrKMF2g3ST4RZ4= +github.com/jonboulle/clockwork v0.4.0/go.mod h1:xgRqUGwRcjKCO1vbZUEtSLrqKoPSsUpK7fnezOII0kc= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= @@ -529,6 +555,7 @@ github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1: github.com/remyoudompheng/bigfft v0.0.0-20190728182440-6a916e37a237/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 h1:OdAsTTz6OkFY5QxjkYwrChwuRruF69c169dPK26NUlk= github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= +github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= @@ -578,6 +605,10 @@ github.com/xdg-go/scram v1.1.1/go.mod h1:RaEWvsqvNKKvBPvcKeFjrG2cJqOkHTiyTpzz23n github.com/xdg-go/stringprep v1.0.2/go.mod h1:8F9zXuvzgwmyT5DUm4GUfZGDdT3W+LCvS6+da4O5kxM= github.com/xdg-go/stringprep v1.0.3 h1:kdwGpVNwPFtjs98xCGkHjQtGKh86rDcRZN17QEMCOIs= github.com/xdg-go/stringprep v1.0.3/go.mod h1:W3f5j4i+9rC0kuIEJL0ky1VpHXQU3ocBgklLGvcBnW8= +github.com/ydb-platform/ydb-go-genproto v0.0.0-20241002120727-5acc94bcb119 h1:ExSVPjuxuGuu91L0cTD2EZnMOr7VIq1vuA2dVYG0+Xc= +github.com/ydb-platform/ydb-go-genproto v0.0.0-20241002120727-5acc94bcb119/go.mod h1:Er+FePu1dNUieD+XTMDduGpQuCPssK5Q4BjF+IIXJ3I= +github.com/ydb-platform/ydb-go-sdk/v3 v3.84.1 h1:QkFhXiwoMRZTr7mxk77UeWXTCmkVXXESvncA/ug35S0= +github.com/ydb-platform/ydb-go-sdk/v3 v3.84.1/go.mod h1:BTLL5DJGTAe4sgr3sRum0OQVdNjG1cMjNwZN1qAq7eo= github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d h1:splanxYIlg+5LfHAM6xpdFEAYOk8iySO56hMFq6uLyA= github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -613,6 +644,7 @@ go.opentelemetry.io/otel/sdk v1.29.0 h1:vkqKjk7gwhS8VaWb0POZKmIEDimRCMsopNYnriHy go.opentelemetry.io/otel/sdk v1.29.0/go.mod h1:pM8Dx5WKnvxLCb+8lG1PRNIDxu9g9b9g59Qr7hfAAok= go.opentelemetry.io/otel/trace v1.29.0 h1:J/8ZNK4XgR7a21DZUAsbF8pZ5Jcw1VhACmnYt39JTi4= go.opentelemetry.io/otel/trace v1.29.0/go.mod h1:eHl3w0sp3paPkYstJOmAimxhiFXPg+MMTlEh3nsQgWQ= +go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.opentelemetry.io/proto/otlp v1.3.1 h1:TrMUixzpM0yuc/znrFTP9MMRh8trP93mkCiDVeXrui0= go.opentelemetry.io/proto/otlp v1.3.1/go.mod h1:0X1WI4de4ZsLrrJNLAQbFeLCm3T7yBkR0XqQ7niQU+8= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= @@ -650,6 +682,8 @@ golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88/go.mod h1:IxCIyHEi3zRg3s0 golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= +golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw= +golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -699,6 +733,7 @@ golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= @@ -710,14 +745,19 @@ golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e/go.mod h1:XRhObCWvk6IyKnWLug golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= +golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= +golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= golang.org/x/oauth2 v0.0.0-20180227000427-d7d64896b5ff/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181106182150-f42d05182288/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.18.0 h1:09qnuIAgzdx1XplqJvW6CQqMCtGZykZWcXzPMPUusvI= golang.org/x/oauth2 v0.18.0/go.mod h1:Wf7knwG0MPoWIMMBgFlEaSUDaKskp0dCfrlJRJXbBi8= +golang.org/x/oauth2 v0.22.0 h1:BzDx2FehcG7jJwgWLELCdmLuxk2i+x9UDpSiss2u0ZA= +golang.org/x/oauth2 v0.22.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -756,6 +796,7 @@ golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -771,11 +812,15 @@ golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.24.0 h1:Mh5cbb+Zk2hqqXNO7S1iTjEphVL+jb8ZWaqh/g+JWkM= golang.org/x/term v0.24.0/go.mod h1:lOBK/LVxemqiMij05LGJ0tzNr8xlmwBRJ81PX6wVLH8= +golang.org/x/term v0.25.0 h1:WtHI/ltw4NvSUig5KARz9h521QvRC8RmF/cuYqifU24= +golang.org/x/term v0.25.0/go.mod h1:RPyXicDX+6vLxogjjRxjgD2TKtmAO6NZBsBRfrOLu7M= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -788,6 +833,8 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= @@ -867,13 +914,18 @@ google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvx google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9 h1:9+tzLLstTlPTRyJTh+ah5wIMsBW5c4tQwGTN3thOW9Y= google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9/go.mod h1:mqHbVIp48Muh7Ywss/AD6I5kNVKZMmAa/QEW58Gxp2s= google.golang.org/genproto/googleapis/api v0.0.0-20240513163218-0867130af1f8 h1:W5Xj/70xIA4x60O/IFyXivR5MGqblAb8R3w26pnD6No= google.golang.org/genproto/googleapis/api v0.0.0-20240513163218-0867130af1f8/go.mod h1:vPrPUTsDCYxXWjP7clS81mZ6/803D8K4iM9Ma27VKas= +google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 h1:wKguEg1hsxI2/L3hUYrpo1RVi48K+uTyzKqprwLXsb8= +google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142/go.mod h1:d6be+8HhtEtucleCbxpPW9PA9XwISACu8nvpPqF0BVo= google.golang.org/genproto/googleapis/rpc v0.0.0-20240513163218-0867130af1f8 h1:mxSlqyb8ZAHsYDCfiXN1EDdNTdvjUJSLY+OnAUtYNYA= google.golang.org/genproto/googleapis/rpc v0.0.0-20240513163218-0867130af1f8/go.mod h1:I7Y+G38R2bu5j1aLzfFmQfTcU/WnFuqDwLZAbvKTKpM= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241015192408-796eee8c2d53 h1:X58yt85/IXCx0Y3ZwN6sEIKZzQtDEYaBWrDvErdXrRE= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241015192408-796eee8c2d53/go.mod h1:GX3210XPVPUjJbTUbvwI8f2IpZDMZuPJWDzDuebbviI= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -881,9 +933,14 @@ google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyac google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= +google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.47.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= google.golang.org/grpc v1.64.1 h1:LKtvyfbX3UGVPFcGqJ9ItpVWW6oN/2XqTxfAnwRRXiA= google.golang.org/grpc v1.64.1/go.mod h1:hiQF4LFZelK2WKaP6W0L92zGHtiQdZxk8CrSdvyjeP0= +google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E= +google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -895,8 +952,12 @@ google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpAD google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= +google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= +google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -913,6 +974,7 @@ gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkep gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= From d8c5027c7e55bbf1b1a5d908566495aa17d9b11e Mon Sep 17 00:00:00 2001 From: Artem Murashko Date: Tue, 22 Oct 2024 20:44:53 +0300 Subject: [PATCH 02/28] implement methods --- database/ydb/ydb.go | 161 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 150 insertions(+), 11 deletions(-) diff --git a/database/ydb/ydb.go b/database/ydb/ydb.go index 68621df5f..80ad3ea20 100644 --- a/database/ydb/ydb.go +++ b/database/ydb/ydb.go @@ -2,12 +2,17 @@ package ydb import ( "context" + "errors" "fmt" "io" + "net/url" "sync/atomic" + "github.com/hashicorp/go-multierror" "github.com/ydb-platform/ydb-go-sdk/v3" + "github.com/ydb-platform/ydb-go-sdk/v3/query" + "github.com/golang-migrate/migrate/v4" "github.com/golang-migrate/migrate/v4/database" ) @@ -52,34 +57,142 @@ func WithInstance(driver *ydb.Driver, config *Config) (database.Driver, error) { if err != nil { return nil, err } - return db, nil } -func (db *YDB) Open(url string) (database.Driver, error) { - return nil, nil +func (db *YDB) Open(dsn string) (database.Driver, error) { + purl, err := url.Parse(dsn) + if err != nil { + return nil, err + } + + query, err := url.ParseQuery(purl.RawQuery) + if err != nil { + return nil, err + } + + purl.Scheme = "grpc" + if query.Has("x-use-grpcs") { + purl.Scheme = "grpcs" + } + + purl = migrate.FilterCustomQuery(purl) + + fmt.Println(purl) + fmt.Println(query) + + driver, err := ydb.Open(context.TODO(), purl.String(), ydb.With()) + if err != nil { + return nil, err + } + + px, err := WithInstance(driver, &Config{ + MigrationsTable: query.Get("x-migrations-table"), + }) + if err != nil { + return nil, err + } + return px, nil } func (db *YDB) Close() error { - return db.driver.Close(context.Background()) + return db.driver.Close(context.TODO()) } func (db *YDB) Run(migration io.Reader) error { - return nil + query, err := io.ReadAll(migration) + if err != nil { + return err + } + + res, err := db.driver.Scripting().Execute(context.TODO(), string(query), nil) + if err != nil { + return err + } + return res.Close() } func (db *YDB) SetVersion(version int, dirty bool) error { - return nil + deleteQuery := fmt.Sprintf(` + DELETE FROM %s + `, db.config.MigrationsTable) + + insertQuery := fmt.Sprintf(` + INSERT INTO %s (version, dirty, created) VALUES (%d, %t, CurrentUtcTimestamp()) + `, db.config.MigrationsTable, version, dirty) + + ctx := context.TODO() + err := db.driver.Query().DoTx(ctx, func(ctx context.Context, tx query.TxActor) error { + if err := tx.Exec(ctx, deleteQuery); err != nil { + return err + } + // Also re-write the schema version for nil dirty versions to prevent + // empty schema version for failed down migration on the first migration + // See: https://github.com/golang-migrate/migrate/issues/330 + if version >= 0 || (version == database.NilVersion && dirty) { + if err := tx.Exec(ctx, insertQuery); err != nil { + return err + } + } + return nil + }, query.WithTxSettings(query.TxSettings(query.WithSerializableReadWrite()))) + return err } func (db *YDB) Version() (version int, dirty bool, err error) { - return -} + getQuery := fmt.Sprintf(` + SELECT version, dirty FROM %s ORDER BY version DESC LIMIT 1 + `, db.config.MigrationsTable) -func (db *YDB) Drop() error { - return nil + rs, err := db.driver.Query().QueryResultSet(context.TODO(), getQuery) + if err != nil { + return 0, false, &database.Error{OrigErr: err, Query: []byte(getQuery)} + } + + row, err := rs.NextRow(context.TODO()) + if err != nil { + if errors.Is(err, io.EOF) { + return database.NilVersion, false, nil + } + return 0, false, err + } + + if err = row.Scan(&version, &dirty); err != nil { + return 0, false, &database.Error{OrigErr: err, Query: []byte(getQuery)} + } + return version, dirty, err } +func (db *YDB) Drop() (err error) { + ctx := context.TODO() + + listQuery := "SELECT DISTINCT Path FROM `.sys/partition_stats` WHERE Path NOT LIKE '%/.sys%'" + rs, err := db.driver.Query().QueryResultSet(context.TODO(), listQuery) + if err != nil { + return &database.Error{OrigErr: err, Query: []byte(listQuery)} + } + + for { + var row query.Row + if row, err = rs.NextRow(ctx); err != nil { + if errors.Is(err, io.EOF) { + break + } + return err + } + + var table string + if err = row.Scan(&table); err != nil { + return err + } + + dropQuery := fmt.Sprintf("DROP TABLE %s", table) + if err = db.driver.Query().Exec(ctx, dropQuery); err != nil { + return &database.Error{OrigErr: err, Query: []byte(dropQuery)} + } + } + return err +} func (db *YDB) Lock() error { if !db.isLocked.CompareAndSwap(false, true) { return database.ErrLocked @@ -96,5 +209,31 @@ func (db *YDB) Unlock() error { // ensureVersionTable checks if versions table exists and, if not, creates it. func (db *YDB) ensureVersionTable() (err error) { - return nil + if err = db.Lock(); err != nil { + return err + } + + defer func() { + if unlockErr := db.Unlock(); unlockErr != nil { + if err == nil { + err = unlockErr + } else { + err = multierror.Append(err, unlockErr) + } + } + }() + + createQuery := fmt.Sprintf(` + CREATE TABLE IF NOT EXISTS %s ( + version_id Uint64, + is_applied Bool, + created Timestamp, + PRIMARY KEY(version_id) + ) + `, db.config.MigrationsTable) + err = db.driver.Query().Exec(context.TODO(), createQuery) + if err != nil { + return err + } + return err } From 8f5631260be1a160abd5c2074f4333feab8dcee8 Mon Sep 17 00:00:00 2001 From: Artem Murashko Date: Wed, 23 Oct 2024 11:36:38 +0300 Subject: [PATCH 03/28] makefile, cli build --- Makefile | 2 +- internal/cli/build_ydb.go | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 internal/cli/build_ydb.go diff --git a/Makefile b/Makefile index 8e23a43c7..7c9535327 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ SOURCE ?= file go_bindata github github_ee bitbucket aws_s3 google_cloud_storage godoc_vfs gitlab -DATABASE ?= postgres mysql redshift cassandra spanner cockroachdb yugabytedb clickhouse mongodb sqlserver firebird neo4j pgx pgx5 rqlite +DATABASE ?= postgres mysql redshift cassandra spanner cockroachdb yugabytedb clickhouse mongodb sqlserver firebird neo4j pgx pgx5 rqlite ydb DATABASE_TEST ?= $(DATABASE) sqlite sqlite3 sqlcipher VERSION ?= $(shell git describe --tags 2>/dev/null | cut -c 2-) TEST_FLAGS ?= diff --git a/internal/cli/build_ydb.go b/internal/cli/build_ydb.go new file mode 100644 index 000000000..baf58a6de --- /dev/null +++ b/internal/cli/build_ydb.go @@ -0,0 +1,8 @@ +//go:build ydb +// +build ydb + +package cli + +import ( + _ "github.com/golang-migrate/migrate/v4/database/ydb" +) From 44abc30d9853e2c68d95e2b36be7aa0ad70ce3ea Mon Sep 17 00:00:00 2001 From: Artem Murashko Date: Wed, 23 Oct 2024 11:38:11 +0300 Subject: [PATCH 04/28] go mod tidy --- go.mod | 6 +++--- go.sum | 52 +++++++++------------------------------------------- 2 files changed, 12 insertions(+), 46 deletions(-) diff --git a/go.mod b/go.mod index 507babb77..b4a5f98f6 100644 --- a/go.mod +++ b/go.mod @@ -36,6 +36,7 @@ require ( github.com/snowflakedb/gosnowflake v1.6.19 github.com/stretchr/testify v1.9.0 github.com/xanzy/go-gitlab v0.15.0 + github.com/ydb-platform/ydb-go-sdk/v3 v3.84.1 go.mongodb.org/mongo-driver v1.7.5 go.uber.org/atomic v1.7.0 golang.org/x/oauth2 v0.22.0 @@ -46,6 +47,7 @@ require ( ) require ( + cel.dev/expr v0.16.0 // indirect github.com/distribution/reference v0.6.0 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/go-logr/logr v1.4.2 // indirect @@ -57,10 +59,10 @@ require ( github.com/moby/docker-image-spec v1.3.1 // indirect github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 // indirect github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect github.com/stretchr/objx v0.5.2 // indirect github.com/ydb-platform/ydb-go-genproto v0.0.0-20241002120727-5acc94bcb119 // indirect - github.com/ydb-platform/ydb-go-sdk/v3 v3.84.1 // indirect go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0 // indirect go.opentelemetry.io/otel v1.29.0 // indirect @@ -73,7 +75,6 @@ require ( require ( cloud.google.com/go v0.112.1 // indirect - cloud.google.com/go/compute v1.25.1 // indirect cloud.google.com/go/compute/metadata v0.5.0 // indirect cloud.google.com/go/iam v1.1.6 // indirect cloud.google.com/go/longrunning v0.5.5 // indirect @@ -189,7 +190,6 @@ require ( golang.org/x/text v0.19.0 // indirect golang.org/x/time v0.5.0 // indirect golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect - google.golang.org/appengine v1.6.8 // indirect google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20241015192408-796eee8c2d53 // indirect diff --git a/go.sum b/go.sum index f55f7b244..b81bed620 100644 --- a/go.sum +++ b/go.sum @@ -1,3 +1,5 @@ +cel.dev/expr v0.16.0 h1:yloc84fytn4zmJX2GU3TkXGsaieaV7dQ057Qs4sIG2Y= +cel.dev/expr v0.16.0/go.mod h1:TRSuuV7DlVCE/uwv5QbAiW/v8l5O8C4eEPHeu7gf7Sg= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= @@ -10,10 +12,6 @@ cloud.google.com/go v0.112.1 h1:uJSeirPke5UNZHIb4SxfZklVSiWWVqW4oXlETwZziwM= cloud.google.com/go v0.112.1/go.mod h1:+Vbu+Y1UU+I1rjmzeMOb/8RfkKJK2Gyxi1X6jJCZLo4= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= -cloud.google.com/go/compute v1.25.1 h1:ZRpHJedLtTpKgr3RV1Fx23NuaAEN1Zfx9hw1u4aJdjU= -cloud.google.com/go/compute v1.25.1/go.mod h1:oopOIR53ly6viBYxaDhBfJwzUAxf1zE//uf3IB011ls= -cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= -cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= cloud.google.com/go/compute/metadata v0.5.0 h1:Zr0eK8JbFv6+Wi4ilXAR8FJ3wyNdpxHKJNPos6LTZOY= cloud.google.com/go/compute/metadata v0.5.0/go.mod h1:aHnloV2TPI38yx4s9+wAZhHykWvVCfu7hQbF+9CWoiY= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= @@ -130,8 +128,6 @@ github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA github.com/census-instrumentation/opencensus-proto v0.4.1 h1:iKLQ0xPNFxR/2hzXZMrBo8f1j86j5WHzznCCQxV/b8g= github.com/census-instrumentation/opencensus-proto v0.4.1/go.mod h1:4T9NM4+4Vw91VeyqjLS6ao50K5bOcLKN6Q42XnYaRYw= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= -github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= @@ -143,8 +139,6 @@ github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XP github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20240318125728-8a4994d93e50 h1:DBmgJDC9dTfkVyGgipamEh2BpGYxScCH1TOF1LL1cXc= -github.com/cncf/xds/go v0.0.0-20240318125728-8a4994d93e50/go.mod h1:5e1+Vvlzido69INQaVO6d87Qn543Xr6nooe9Kz7oBFM= github.com/cncf/xds/go v0.0.0-20240723142845-024c85f92f20 h1:N+3sFI5GUjRKBi+i0TxYVST9h4Ie192jJWpHvthBBgg= github.com/cncf/xds/go v0.0.0-20240723142845-024c85f92f20/go.mod h1:W+zGtBO5Y1IgJhy4+A9GOqVhqLpfZi+vwmdNXUehLA8= github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I= @@ -190,13 +184,9 @@ github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.m github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= -github.com/envoyproxy/go-control-plane v0.12.0 h1:4X+VP1GHd1Mhj6IB5mMeGbLCleqxjletLK6K0rbxyZI= -github.com/envoyproxy/go-control-plane v0.12.0/go.mod h1:ZBTaoJ23lqITozF0M6G4/IragXCQKCnYbmlmtHvwRG0= github.com/envoyproxy/go-control-plane v0.13.0 h1:HzkeUz1Knt+3bK+8LG1bxOO/jzWZmdxpwC51i202les= github.com/envoyproxy/go-control-plane v0.13.0/go.mod h1:GRaKG3dwvFoTg4nj7aXdZnvMg4d7nvT/wl9WgVXn3Q8= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/envoyproxy/protoc-gen-validate v1.0.4 h1:gVPz/FMfvh57HdSJQyvBtF00j8JU4zdyUgIUNhlgg0A= -github.com/envoyproxy/protoc-gen-validate v1.0.4/go.mod h1:qys6tmnRsYrQqIhm2bvKZH4Blx/1gTIZ2UKVY1M+Yew= github.com/envoyproxy/protoc-gen-validate v1.1.0 h1:tntQDh69XqOCOZsDz0lVJQez/2L6Uu2PdjCQwWCJ3bM= github.com/envoyproxy/protoc-gen-validate v1.1.0/go.mod h1:sXRDRVmzEbkM7CVcM06s9shE/m23dg3wzjl0UWqJ2q4= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= @@ -240,7 +230,6 @@ github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRx github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang-jwt/jwt/v4 v4.0.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= -github.com/golang-jwt/jwt/v4 v4.4.2 h1:rcc4lwaZgFMCZ5jxF9ABolDcIHdBytAFgqFPbSJQAYs= github.com/golang-jwt/jwt/v4 v4.4.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= @@ -329,6 +318,7 @@ github.com/gorilla/mux v1.7.4 h1:VuZ8uybHlWmqV03+zRzdwKL4tUnIp1MAQtp1mIFE1bc= github.com/gorilla/mux v1.7.4/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4= github.com/gorilla/sessions v1.2.1/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/zI+bUmuGM= +github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 h1:bkypFPDjIYGfCYD5mRBvpqxfYX1YCS1PXdKYWi8FsN0= github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0/go.mod h1:P+Lt/0by1T8bfcF3z737NnSbmxQAppXMRziHUxPOC8k= @@ -549,9 +539,13 @@ github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzL github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 h1:GFCKgmp0tecUJ0sJuv4pzYCqS9+RGSn52M3FUwPs+uo= +github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10/go.mod h1:t/avpk3KcrXxUnYOhZhMXJlSEyie6gQbtLq5NM3loB8= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/rekby/fixenv v0.6.1 h1:jUFiSPpajT4WY2cYuc++7Y1zWrnCxnovGCIX72PZniM= +github.com/rekby/fixenv v0.6.1/go.mod h1:/b5LRc06BYJtslRtHKxsPWFT/ySpHV+rWvzTg+XWk4c= github.com/remyoudompheng/bigfft v0.0.0-20190728182440-6a916e37a237/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 h1:OdAsTTz6OkFY5QxjkYwrChwuRruF69c169dPK26NUlk= github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= @@ -613,7 +607,6 @@ github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d h1:splanxYIlg+5LfHAM github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/zeebo/assert v1.3.0 h1:g7C04CbJuIDKNPFHmsk4hwZDO5O+kntRxzaUoNXj+IQ= github.com/zeebo/assert v1.3.0/go.mod h1:Pq9JiuJQpG8JLJdtkwrJESF0Foym2/D9XMU5ciN/wJ0= github.com/zeebo/xxh3 v1.0.2 h1:xZmwmqxHZA8AI603jOQ0tMqmBr9lPeFwGg6d+xy9DC0= @@ -653,6 +646,8 @@ go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= +go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU= @@ -677,11 +672,8 @@ golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= -golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw= golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -710,7 +702,6 @@ golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0= golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -742,9 +733,6 @@ golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= -golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= golang.org/x/oauth2 v0.0.0-20180227000427-d7d64896b5ff/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -754,8 +742,6 @@ golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4Iltr golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.18.0 h1:09qnuIAgzdx1XplqJvW6CQqMCtGZykZWcXzPMPUusvI= -golang.org/x/oauth2 v0.18.0/go.mod h1:Wf7knwG0MPoWIMMBgFlEaSUDaKskp0dCfrlJRJXbBi8= golang.org/x/oauth2 v0.22.0 h1:BzDx2FehcG7jJwgWLELCdmLuxk2i+x9UDpSiss2u0ZA= golang.org/x/oauth2 v0.22.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -765,7 +751,6 @@ golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180224232135-f6cff0780e54/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -808,17 +793,12 @@ golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220224120231-95c6836cb0e7/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.24.0 h1:Mh5cbb+Zk2hqqXNO7S1iTjEphVL+jb8ZWaqh/g+JWkM= -golang.org/x/term v0.24.0/go.mod h1:lOBK/LVxemqiMij05LGJ0tzNr8xlmwBRJ81PX6wVLH8= golang.org/x/term v0.25.0 h1:WtHI/ltw4NvSUig5KARz9h521QvRC8RmF/cuYqifU24= golang.org/x/term v0.25.0/go.mod h1:RPyXicDX+6vLxogjjRxjgD2TKtmAO6NZBsBRfrOLu7M= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -830,9 +810,6 @@ golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -870,7 +847,6 @@ golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roY golang.org/x/tools v0.0.0-20201124115921-2c860bdd6e78/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.24.0 h1:J1shsA93PJUEVaUSaay7UXAyE8aimq3GW0pjlolpa24= golang.org/x/tools v0.24.0/go.mod h1:YhNqVBIfWHdzvTLs0d8LCuMhkKUgSUKldakyV7W/WDQ= golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -900,8 +876,6 @@ google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7 google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM= -google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= @@ -918,12 +892,8 @@ google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfG google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9 h1:9+tzLLstTlPTRyJTh+ah5wIMsBW5c4tQwGTN3thOW9Y= google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9/go.mod h1:mqHbVIp48Muh7Ywss/AD6I5kNVKZMmAa/QEW58Gxp2s= -google.golang.org/genproto/googleapis/api v0.0.0-20240513163218-0867130af1f8 h1:W5Xj/70xIA4x60O/IFyXivR5MGqblAb8R3w26pnD6No= -google.golang.org/genproto/googleapis/api v0.0.0-20240513163218-0867130af1f8/go.mod h1:vPrPUTsDCYxXWjP7clS81mZ6/803D8K4iM9Ma27VKas= google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 h1:wKguEg1hsxI2/L3hUYrpo1RVi48K+uTyzKqprwLXsb8= google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142/go.mod h1:d6be+8HhtEtucleCbxpPW9PA9XwISACu8nvpPqF0BVo= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240513163218-0867130af1f8 h1:mxSlqyb8ZAHsYDCfiXN1EDdNTdvjUJSLY+OnAUtYNYA= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240513163218-0867130af1f8/go.mod h1:I7Y+G38R2bu5j1aLzfFmQfTcU/WnFuqDwLZAbvKTKpM= google.golang.org/genproto/googleapis/rpc v0.0.0-20241015192408-796eee8c2d53 h1:X58yt85/IXCx0Y3ZwN6sEIKZzQtDEYaBWrDvErdXrRE= google.golang.org/genproto/googleapis/rpc v0.0.0-20241015192408-796eee8c2d53/go.mod h1:GX3210XPVPUjJbTUbvwI8f2IpZDMZuPJWDzDuebbviI= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= @@ -937,8 +907,6 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.47.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= -google.golang.org/grpc v1.64.1 h1:LKtvyfbX3UGVPFcGqJ9ItpVWW6oN/2XqTxfAnwRRXiA= -google.golang.org/grpc v1.64.1/go.mod h1:hiQF4LFZelK2WKaP6W0L92zGHtiQdZxk8CrSdvyjeP0= google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E= google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= @@ -954,8 +922,6 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= -google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= From 4dd2ac55471640da1d5f1c640d04dacadd10e923 Mon Sep 17 00:00:00 2001 From: Artem Murashko Date: Wed, 23 Oct 2024 11:55:23 +0300 Subject: [PATCH 05/28] some fixes --- database/ydb/ydb.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/database/ydb/ydb.go b/database/ydb/ydb.go index 80ad3ea20..0905ebdbd 100644 --- a/database/ydb/ydb.go +++ b/database/ydb/ydb.go @@ -157,10 +157,11 @@ func (db *YDB) Version() (version int, dirty bool, err error) { return 0, false, err } - if err = row.Scan(&version, &dirty); err != nil { + var v uint64 + if err = row.Scan(&v, &dirty); err != nil { return 0, false, &database.Error{OrigErr: err, Query: []byte(getQuery)} } - return version, dirty, err + return int(v), dirty, err } func (db *YDB) Drop() (err error) { @@ -225,10 +226,10 @@ func (db *YDB) ensureVersionTable() (err error) { createQuery := fmt.Sprintf(` CREATE TABLE IF NOT EXISTS %s ( - version_id Uint64, - is_applied Bool, + version Uint64, + dirty Bool, created Timestamp, - PRIMARY KEY(version_id) + PRIMARY KEY(version) ) `, db.config.MigrationsTable) err = db.driver.Query().Exec(context.TODO(), createQuery) From ee172d89c004169db462af54786c40adb6ab8207 Mon Sep 17 00:00:00 2001 From: Artem Murashko Date: Mon, 4 Nov 2024 14:32:39 +0300 Subject: [PATCH 06/28] refactor --- database/ydb/ydb.go | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/database/ydb/ydb.go b/database/ydb/ydb.go index 0905ebdbd..52d039aed 100644 --- a/database/ydb/ydb.go +++ b/database/ydb/ydb.go @@ -53,8 +53,7 @@ func WithInstance(driver *ydb.Driver, config *Config) (database.Driver, error) { driver: driver, config: config, } - err := db.ensureVersionTable() - if err != nil { + if err := db.ensureVersionTable(); err != nil { return nil, err } return db, nil @@ -66,20 +65,18 @@ func (db *YDB) Open(dsn string) (database.Driver, error) { return nil, err } - query, err := url.ParseQuery(purl.RawQuery) + pquery, err := url.ParseQuery(purl.RawQuery) if err != nil { return nil, err } purl.Scheme = "grpc" - if query.Has("x-use-grpcs") { + if pquery.Has("x-use-grpcs") { purl.Scheme = "grpcs" } purl = migrate.FilterCustomQuery(purl) - - fmt.Println(purl) - fmt.Println(query) + fmt.Println(purl, pquery) driver, err := ydb.Open(context.TODO(), purl.String(), ydb.With()) if err != nil { @@ -87,7 +84,7 @@ func (db *YDB) Open(dsn string) (database.Driver, error) { } px, err := WithInstance(driver, &Config{ - MigrationsTable: query.Get("x-migrations-table"), + MigrationsTable: pquery.Get("x-migrations-table"), }) if err != nil { return nil, err @@ -100,12 +97,12 @@ func (db *YDB) Close() error { } func (db *YDB) Run(migration io.Reader) error { - query, err := io.ReadAll(migration) + rawMigrations, err := io.ReadAll(migration) if err != nil { return err } - res, err := db.driver.Scripting().Execute(context.TODO(), string(query), nil) + res, err := db.driver.Scripting().Execute(context.TODO(), string(rawMigrations), nil) if err != nil { return err } @@ -113,24 +110,24 @@ func (db *YDB) Run(migration io.Reader) error { } func (db *YDB) SetVersion(version int, dirty bool) error { - deleteQuery := fmt.Sprintf(` + deleteVersionQuery := fmt.Sprintf(` DELETE FROM %s `, db.config.MigrationsTable) - insertQuery := fmt.Sprintf(` + insertVersionQuery := fmt.Sprintf(` INSERT INTO %s (version, dirty, created) VALUES (%d, %t, CurrentUtcTimestamp()) `, db.config.MigrationsTable, version, dirty) ctx := context.TODO() err := db.driver.Query().DoTx(ctx, func(ctx context.Context, tx query.TxActor) error { - if err := tx.Exec(ctx, deleteQuery); err != nil { + if err := tx.Exec(ctx, deleteVersionQuery); err != nil { return err } // Also re-write the schema version for nil dirty versions to prevent // empty schema version for failed down migration on the first migration // See: https://github.com/golang-migrate/migrate/issues/330 if version >= 0 || (version == database.NilVersion && dirty) { - if err := tx.Exec(ctx, insertQuery); err != nil { + if err := tx.Exec(ctx, insertVersionQuery); err != nil { return err } } @@ -140,13 +137,13 @@ func (db *YDB) SetVersion(version int, dirty bool) error { } func (db *YDB) Version() (version int, dirty bool, err error) { - getQuery := fmt.Sprintf(` + getVersionQuery := fmt.Sprintf(` SELECT version, dirty FROM %s ORDER BY version DESC LIMIT 1 `, db.config.MigrationsTable) - rs, err := db.driver.Query().QueryResultSet(context.TODO(), getQuery) + rs, err := db.driver.Query().QueryResultSet(context.TODO(), getVersionQuery) if err != nil { - return 0, false, &database.Error{OrigErr: err, Query: []byte(getQuery)} + return 0, false, &database.Error{OrigErr: err, Query: []byte(getVersionQuery)} } row, err := rs.NextRow(context.TODO()) @@ -159,7 +156,7 @@ func (db *YDB) Version() (version int, dirty bool, err error) { var v uint64 if err = row.Scan(&v, &dirty); err != nil { - return 0, false, &database.Error{OrigErr: err, Query: []byte(getQuery)} + return 0, false, &database.Error{OrigErr: err, Query: []byte(getVersionQuery)} } return int(v), dirty, err } @@ -224,7 +221,7 @@ func (db *YDB) ensureVersionTable() (err error) { } }() - createQuery := fmt.Sprintf(` + createVersionTableQuery := fmt.Sprintf(` CREATE TABLE IF NOT EXISTS %s ( version Uint64, dirty Bool, @@ -232,7 +229,7 @@ func (db *YDB) ensureVersionTable() (err error) { PRIMARY KEY(version) ) `, db.config.MigrationsTable) - err = db.driver.Query().Exec(context.TODO(), createQuery) + err = db.driver.Query().Exec(context.TODO(), createVersionTableQuery) if err != nil { return err } From 754a74d909e529cd1f81cd1f3dedd75cec3255fd Mon Sep 17 00:00:00 2001 From: Artem Murashko Date: Mon, 4 Nov 2024 15:00:56 +0300 Subject: [PATCH 07/28] fix drop func --- database/ydb/ydb.go | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/database/ydb/ydb.go b/database/ydb/ydb.go index 52d039aed..a226931b0 100644 --- a/database/ydb/ydb.go +++ b/database/ydb/ydb.go @@ -137,16 +137,23 @@ func (db *YDB) SetVersion(version int, dirty bool) error { } func (db *YDB) Version() (version int, dirty bool, err error) { + ctx := context.TODO() + getVersionQuery := fmt.Sprintf(` SELECT version, dirty FROM %s ORDER BY version DESC LIMIT 1 `, db.config.MigrationsTable) - rs, err := db.driver.Query().QueryResultSet(context.TODO(), getVersionQuery) + rs, err := db.driver.Query().QueryResultSet(ctx, getVersionQuery) if err != nil { return 0, false, &database.Error{OrigErr: err, Query: []byte(getVersionQuery)} } + defer func() { + if closeErr := rs.Close(ctx); closeErr != nil { + err = multierror.Append(err, closeErr) + } + }() - row, err := rs.NextRow(context.TODO()) + row, err := rs.NextRow(ctx) if err != nil { if errors.Is(err, io.EOF) { return database.NilVersion, false, nil @@ -169,11 +176,17 @@ func (db *YDB) Drop() (err error) { if err != nil { return &database.Error{OrigErr: err, Query: []byte(listQuery)} } + defer func() { + if closeErr := rs.Close(ctx); closeErr != nil { + err = multierror.Append(err, closeErr) + } + }() for { var row query.Row if row, err = rs.NextRow(ctx); err != nil { if errors.Is(err, io.EOF) { + err = nil break } return err @@ -184,11 +197,12 @@ func (db *YDB) Drop() (err error) { return err } - dropQuery := fmt.Sprintf("DROP TABLE %s", table) + dropQuery := fmt.Sprintf("DROP TABLE `%s`", table) if err = db.driver.Query().Exec(ctx, dropQuery); err != nil { return &database.Error{OrigErr: err, Query: []byte(dropQuery)} } } + return err } func (db *YDB) Lock() error { From a7e222d7947e7fe2e10c07b0c93aecba3677cec5 Mon Sep 17 00:00:00 2001 From: Artem Murashko Date: Mon, 4 Nov 2024 16:10:40 +0300 Subject: [PATCH 08/28] update readme --- database/ydb/README.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 database/ydb/README.md diff --git a/database/ydb/README.md b/database/ydb/README.md new file mode 100644 index 000000000..f1bae39f6 --- /dev/null +++ b/database/ydb/README.md @@ -0,0 +1,30 @@ +# [YDB](https://ydb.tech/docs/) + +`ydb://[user:password@]host:port/database?QUERY_PARAMS` + +| URL Query | Description | +|:----------:|:---------------------------------------:| +| `user` | The user to sign in as. | +| `password` | The user's password. | +| `host` | The host to connect to. | +| `port` | The port to bind to. | | +| `database` | The name of the database to connect to. | + +| URL Query Params | Description | +|:--------------------:|:-----------------------------------------------------------:| +| `x-auth-token` | Authentication token. | +| `x-migrations-table` | Name of the migrations table (default `schema_migrations`). | +| `x-use-grpcs` | Enables gRPCS protocol for YDB connections (default grpc). | + +### Authentication + +By default, golang-migrate connects to YDB +using [anonymous credentials](https://ydb.tech/docs/en/recipes/ydb-sdk/auth-anonymous). \ +Through the url query, you can change the default behavior: + +- To connect to YDB using [static credentials](https://ydb.tech/docs/en/recipes/ydb-sdk/auth-static) you need to specify + username and password: + `ydb://user:password@host:port/database` +- To connect to YDB using [token](https://ydb.tech/docs/en/recipes/ydb-sdk/auth-access-token) you need to specify token + as query parameter: + `ydb://host:port/database?x-auth-token=` \ No newline at end of file From 532b4ac70a3c3dfc0aa68cd8201251c24a8d54ec Mon Sep 17 00:00:00 2001 From: Artem Murashko Date: Mon, 4 Nov 2024 16:46:41 +0300 Subject: [PATCH 09/28] add auth methods --- database/ydb/ydb.go | 42 ++++++++++++++++++++++++++++++++++-------- 1 file changed, 34 insertions(+), 8 deletions(-) diff --git a/database/ydb/ydb.go b/database/ydb/ydb.go index a226931b0..da690be39 100644 --- a/database/ydb/ydb.go +++ b/database/ydb/ydb.go @@ -21,7 +21,13 @@ func init() { database.Register("ydb", &db) } -const DefaultMigrationsTable = "schema_migrations" +const ( + defaultMigrationsTable = "schema_migrations" + + queryParamAuthToken = "x-auth-token" + queryParamMigrationsTable = "x-migrations-table" + queryParamUseGRPCS = "x-use-grpcs" +) var ( ErrDatabaseDirty = fmt.Errorf("database is dirty") @@ -46,7 +52,7 @@ func WithInstance(driver *ydb.Driver, config *Config) (database.Driver, error) { } if len(config.MigrationsTable) == 0 { - config.MigrationsTable = DefaultMigrationsTable + config.MigrationsTable = defaultMigrationsTable } db := &YDB{ @@ -65,26 +71,31 @@ func (db *YDB) Open(dsn string) (database.Driver, error) { return nil, err } + if len(purl.Path) == 0 { + return nil, ErrNoDatabaseName + } + pquery, err := url.ParseQuery(purl.RawQuery) if err != nil { return nil, err } - purl.Scheme = "grpc" - if pquery.Has("x-use-grpcs") { + switch { + case pquery.Has(queryParamUseGRPCS): purl.Scheme = "grpcs" + default: + purl.Scheme = "grpc" } purl = migrate.FilterCustomQuery(purl) - fmt.Println(purl, pquery) - - driver, err := ydb.Open(context.TODO(), purl.String(), ydb.With()) + credentials := db.parseCredentials(purl, pquery) + driver, err := ydb.Open(context.TODO(), purl.String(), credentials) if err != nil { return nil, err } px, err := WithInstance(driver, &Config{ - MigrationsTable: pquery.Get("x-migrations-table"), + MigrationsTable: pquery.Get(queryParamMigrationsTable), }) if err != nil { return nil, err @@ -92,6 +103,21 @@ func (db *YDB) Open(dsn string) (database.Driver, error) { return px, nil } +func (db *YDB) parseCredentials(url *url.URL, query url.Values) (credentials ydb.Option) { + switch { + case query.Has(queryParamAuthToken): + credentials = ydb.WithAccessTokenCredentials(query.Get(queryParamAuthToken)) + case url.User != nil: + user := url.User.Username() + password, _ := url.User.Password() + credentials = ydb.WithStaticCredentials(user, password) + default: + credentials = ydb.WithAnonymousCredentials() + } + url.User = nil + return credentials +} + func (db *YDB) Close() error { return db.driver.Close(context.TODO()) } From 86ae1fa8dc8e14c7284f25fbbec5099515c1b883 Mon Sep 17 00:00:00 2001 From: Artem Murashko Date: Mon, 4 Nov 2024 16:47:42 +0300 Subject: [PATCH 10/28] refactor --- database/ydb/ydb.go | 1 - 1 file changed, 1 deletion(-) diff --git a/database/ydb/ydb.go b/database/ydb/ydb.go index da690be39..d01ed4d2f 100644 --- a/database/ydb/ydb.go +++ b/database/ydb/ydb.go @@ -30,7 +30,6 @@ const ( ) var ( - ErrDatabaseDirty = fmt.Errorf("database is dirty") ErrNilConfig = fmt.Errorf("no config") ErrNoDatabaseName = fmt.Errorf("no database name") ) From 7bfd0983da3f8322b7a61bb39dc624e070bb2ac6 Mon Sep 17 00:00:00 2001 From: Artem Murashko Date: Mon, 4 Nov 2024 16:53:44 +0300 Subject: [PATCH 11/28] update readme --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index a79cc7b76..16c2e1565 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,7 @@ Database drivers run migrations. [Add a new database?](database/driver.go) * [Firebird](database/firebird) * [MS SQL Server](database/sqlserver) * [rqlite](database/rqlite) +* [YDB](database/ydb) ### Database URLs From bd9bdaecc180d68ab9217662c37ef2985be6ae7a Mon Sep 17 00:00:00 2001 From: Artem Murashko Date: Mon, 4 Nov 2024 17:32:32 +0300 Subject: [PATCH 12/28] add tests --- .../ydb/examples/migrations/001_init.down.yql | 1 + .../ydb/examples/migrations/001_init.up.yql | 4 + .../migrations/002_test_create.down.yql | 1 + .../migrations/002_test_create.up.yql | 5 ++ .../migrations/003_alter_table.down.yql | 4 + .../migrations/003_alter_table.up.yql | 11 +++ .../migrations/004_drop_column.down.yql | 2 + .../migrations/004_drop_column.up.yql | 2 + database/ydb/ydb_test.go | 83 +++++++++++++++++++ 9 files changed, 113 insertions(+) create mode 100644 database/ydb/examples/migrations/001_init.down.yql create mode 100644 database/ydb/examples/migrations/001_init.up.yql create mode 100644 database/ydb/examples/migrations/002_test_create.down.yql create mode 100644 database/ydb/examples/migrations/002_test_create.up.yql create mode 100644 database/ydb/examples/migrations/003_alter_table.down.yql create mode 100644 database/ydb/examples/migrations/003_alter_table.up.yql create mode 100644 database/ydb/examples/migrations/004_drop_column.down.yql create mode 100644 database/ydb/examples/migrations/004_drop_column.up.yql create mode 100644 database/ydb/ydb_test.go diff --git a/database/ydb/examples/migrations/001_init.down.yql b/database/ydb/examples/migrations/001_init.down.yql new file mode 100644 index 000000000..9e845f2fa --- /dev/null +++ b/database/ydb/examples/migrations/001_init.down.yql @@ -0,0 +1 @@ +DROP TABLE test_1; \ No newline at end of file diff --git a/database/ydb/examples/migrations/001_init.up.yql b/database/ydb/examples/migrations/001_init.up.yql new file mode 100644 index 000000000..4854e2814 --- /dev/null +++ b/database/ydb/examples/migrations/001_init.up.yql @@ -0,0 +1,4 @@ +CREATE TABLE test_1 ( + id Uint64, + PRIMARY KEY(id) +); \ No newline at end of file diff --git a/database/ydb/examples/migrations/002_test_create.down.yql b/database/ydb/examples/migrations/002_test_create.down.yql new file mode 100644 index 000000000..bd97a17c6 --- /dev/null +++ b/database/ydb/examples/migrations/002_test_create.down.yql @@ -0,0 +1 @@ +DROP TABLE `meta/test_table`; diff --git a/database/ydb/examples/migrations/002_test_create.up.yql b/database/ydb/examples/migrations/002_test_create.up.yql new file mode 100644 index 000000000..b4a8115e9 --- /dev/null +++ b/database/ydb/examples/migrations/002_test_create.up.yql @@ -0,0 +1,5 @@ +CREATE TABLE `meta/test_table` ( + id Utf8, + field Uint64, + PRIMARY KEY (id) +); diff --git a/database/ydb/examples/migrations/003_alter_table.down.yql b/database/ydb/examples/migrations/003_alter_table.down.yql new file mode 100644 index 000000000..4f822cb7c --- /dev/null +++ b/database/ydb/examples/migrations/003_alter_table.down.yql @@ -0,0 +1,4 @@ +ALTER TABLE `meta/test_table` + DROP COLUMN new_field; + +DROP TABLE `meta/new_test_table`; diff --git a/database/ydb/examples/migrations/003_alter_table.up.yql b/database/ydb/examples/migrations/003_alter_table.up.yql new file mode 100644 index 000000000..65bad82e1 --- /dev/null +++ b/database/ydb/examples/migrations/003_alter_table.up.yql @@ -0,0 +1,11 @@ +ALTER TABLE `meta/test_table` + ADD COLUMN new_field Utf8; + +CREATE TABLE `meta/new_test_table` ( + id Utf8, + field Uint64, + PRIMARY KEY (id) +); + +ALTER TABLE `meta/new_test_table` + ADD COLUMN new_field Utf8; diff --git a/database/ydb/examples/migrations/004_drop_column.down.yql b/database/ydb/examples/migrations/004_drop_column.down.yql new file mode 100644 index 000000000..f12fda0a7 --- /dev/null +++ b/database/ydb/examples/migrations/004_drop_column.down.yql @@ -0,0 +1,2 @@ +ALTER TABLE `meta/test_table` + ADD COLUMN new_field Utf8; diff --git a/database/ydb/examples/migrations/004_drop_column.up.yql b/database/ydb/examples/migrations/004_drop_column.up.yql new file mode 100644 index 000000000..493cc983b --- /dev/null +++ b/database/ydb/examples/migrations/004_drop_column.up.yql @@ -0,0 +1,2 @@ +ALTER TABLE `meta/test_table` + DROP COLUMN new_field; diff --git a/database/ydb/ydb_test.go b/database/ydb/ydb_test.go new file mode 100644 index 000000000..275427e31 --- /dev/null +++ b/database/ydb/ydb_test.go @@ -0,0 +1,83 @@ +package ydb + +import ( + "testing" + "time" + + "github.com/dhui/dktest" + "github.com/docker/go-connections/nat" + + "github.com/golang-migrate/migrate/v4" + dt "github.com/golang-migrate/migrate/v4/database/testing" + _ "github.com/golang-migrate/migrate/v4/source/file" +) + +const ( + image = "cr.yandex/yc/yandex-docker-local-ydb:latest" +) + +var ( + opts = dktest.Options{ + Env: map[string]string{ + "YDB_USE_IN_MEMORY_PDISKS": "true", + "GRPC_PORT": "2136", + }, + + PortBindings: nat.PortMap{ + nat.Port("2136/tcp"): []nat.PortBinding{ + { + HostIP: "0.0.0.0", + HostPort: "2136", + }, + }, + }, + + Hostname: "localhost", + ReadyTimeout: 15 * time.Second, + } +) + +func Test(t *testing.T) { + dktest.Run(t, image, opts, func(t *testing.T, c dktest.ContainerInfo) { + ydb := &YDB{} + + d, err := ydb.Open("ydb://localhost:2136/local") + if err != nil { + t.Fatal(err) + } + + defer func() { + err := d.Close() + if err != nil { + t.Fatal(err) + } + }() + + dt.Test(t, d, []byte("CREATE TABLE `nested/a/b/c/table` (x Uint64 NOT NULL, PRIMARY KEY (x))")) + }) +} + +func TestMigrate(t *testing.T) { + dktest.Run(t, image, opts, func(t *testing.T, c dktest.ContainerInfo) { + ydb := &YDB{} + + d, err := ydb.Open("ydb://localhost:2136/local") + if err != nil { + t.Fatal(err) + } + + defer func() { + err := d.Close() + if err != nil { + t.Fatal(err) + } + }() + + m, err := migrate.NewWithDatabaseInstance("file://./examples/migrations", "ydb", d) + if err != nil { + t.Fatal(err) + } + + dt.TestMigrate(t, m) + }) +} From 0d18ddb67ad6ce20a23b17be5c30699dc120ba07 Mon Sep 17 00:00:00 2001 From: Artem Murashko Date: Sun, 10 Nov 2024 00:52:50 +0300 Subject: [PATCH 13/28] fix test --- database/ydb/ydb_test.go | 51 +++++++++++++++++++++++++++++++--------- 1 file changed, 40 insertions(+), 11 deletions(-) diff --git a/database/ydb/ydb_test.go b/database/ydb/ydb_test.go index 275427e31..614491fdc 100644 --- a/database/ydb/ydb_test.go +++ b/database/ydb/ydb_test.go @@ -1,11 +1,15 @@ package ydb import ( + "context" + "fmt" + "strings" "testing" "time" "github.com/dhui/dktest" "github.com/docker/go-connections/nat" + "github.com/ydb-platform/ydb-go-sdk/v3" "github.com/golang-migrate/migrate/v4" dt "github.com/golang-migrate/migrate/v4/database/testing" @@ -14,34 +18,60 @@ import ( const ( image = "cr.yandex/yc/yandex-docker-local-ydb:latest" + host = "localhost" + port = "2136" ) var ( opts = dktest.Options{ Env: map[string]string{ - "YDB_USE_IN_MEMORY_PDISKS": "true", - "GRPC_PORT": "2136", + "YDB_USE_IN_MEMORY_PDISKS": "true", + "YDB_LOCAL_SURVIVE_RESTART": "true", + "GRPC_PORT": port, }, PortBindings: nat.PortMap{ nat.Port("2136/tcp"): []nat.PortBinding{ { HostIP: "0.0.0.0", - HostPort: "2136", + HostPort: port, }, }, }, - Hostname: "localhost", + Hostname: host, ReadyTimeout: 15 * time.Second, + ReadyFunc: isReady, } ) +func connectionString(options ...string) string { + return fmt.Sprintf("grpc://%s:%s/local?%s", host, port, strings.Join(options, "&")) +} + +func isReady(ctx context.Context, c dktest.ContainerInfo) bool { + fmt.Println("1 connect") + d, err := ydb.Open(ctx, connectionString()) + if err != nil { + fmt.Println("2 err connect", err) + return false + } + defer func() { _ = d.Close(ctx) }() + + fmt.Println("3 execute") + res, err := d.Scripting().Execute(ctx, "SELECT 1", nil) + if err != nil { + fmt.Println("4 err execute", err) + return false + } + defer func() { _ = res.Close() }() + return true +} + func Test(t *testing.T) { dktest.Run(t, image, opts, func(t *testing.T, c dktest.ContainerInfo) { - ydb := &YDB{} - - d, err := ydb.Open("ydb://localhost:2136/local") + db := &YDB{} + d, err := db.Open(connectionString()) if err != nil { t.Fatal(err) } @@ -53,15 +83,14 @@ func Test(t *testing.T) { } }() - dt.Test(t, d, []byte("CREATE TABLE `nested/a/b/c/table` (x Uint64 NOT NULL, PRIMARY KEY (x))")) + dt.Test(t, d, []byte("CREATE TABLE `a/b/c/d/table` (x Uint64 NOT NULL, PRIMARY KEY (x))")) }) } func TestMigrate(t *testing.T) { dktest.Run(t, image, opts, func(t *testing.T, c dktest.ContainerInfo) { - ydb := &YDB{} - - d, err := ydb.Open("ydb://localhost:2136/local") + db := &YDB{} + d, err := db.Open(connectionString()) if err != nil { t.Fatal(err) } From 2e3253ba31e211a5f8936f79d9b155621c10b115 Mon Sep 17 00:00:00 2001 From: Artem Murashko Date: Sun, 10 Nov 2024 01:09:33 +0300 Subject: [PATCH 14/28] rm logs --- database/ydb/ydb_test.go | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/database/ydb/ydb_test.go b/database/ydb/ydb_test.go index 614491fdc..5bee90d5f 100644 --- a/database/ydb/ydb_test.go +++ b/database/ydb/ydb_test.go @@ -17,17 +17,16 @@ import ( ) const ( - image = "cr.yandex/yc/yandex-docker-local-ydb:latest" - host = "localhost" - port = "2136" + image = "cr.yandex/yc/yandex-docker-local-ydb:latest" + host = "localhost" + port = "2136" + databaseName = "local" ) var ( opts = dktest.Options{ Env: map[string]string{ - "YDB_USE_IN_MEMORY_PDISKS": "true", - "YDB_LOCAL_SURVIVE_RESTART": "true", - "GRPC_PORT": port, + "YDB_USE_IN_MEMORY_PDISKS": "true", }, PortBindings: nat.PortMap{ @@ -46,22 +45,23 @@ var ( ) func connectionString(options ...string) string { - return fmt.Sprintf("grpc://%s:%s/local?%s", host, port, strings.Join(options, "&")) + return fmt.Sprintf("ydb://%s:%s/%s?%s", host, port, databaseName, strings.Join(options, "&")) } func isReady(ctx context.Context, c dktest.ContainerInfo) bool { - fmt.Println("1 connect") - d, err := ydb.Open(ctx, connectionString()) + d, err := ydb.Open(ctx, fmt.Sprintf("grpc://%s:%s/%s", host, port, databaseName)) if err != nil { - fmt.Println("2 err connect", err) return false } defer func() { _ = d.Close(ctx) }() - fmt.Println("3 execute") - res, err := d.Scripting().Execute(ctx, "SELECT 1", nil) + res, err := d.Scripting().Execute(ctx, ` + CREATE TABLE test ( + id Int, + PRIMARY KEY(id) + ); + DROP TABLE test;`, nil) if err != nil { - fmt.Println("4 err execute", err) return false } defer func() { _ = res.Close() }() From 5b21bf5dce21dd3f34405efc0ae7c2be3bc6c026 Mon Sep 17 00:00:00 2001 From: Artem Murashko Date: Sun, 10 Nov 2024 01:48:31 +0300 Subject: [PATCH 15/28] refactor test files --- .../ydb/examples/migrations/001_create_users.down.yql | 1 + .../ydb/examples/migrations/001_create_users.up.yql | 6 ++++++ database/ydb/examples/migrations/001_init.down.yql | 1 - database/ydb/examples/migrations/001_init.up.yql | 4 ---- .../migrations/002_add_city_to_users.down.yql | 4 ++++ .../examples/migrations/002_add_city_to_users.up.yql | 8 ++++++++ .../ydb/examples/migrations/002_test_create.down.yql | 1 - .../ydb/examples/migrations/002_test_create.up.yql | 5 ----- .../ydb/examples/migrations/003_alter_table.down.yql | 4 ---- .../ydb/examples/migrations/003_alter_table.up.yql | 11 ----------- .../ydb/examples/migrations/003_create_topic.down.yql | 1 + .../ydb/examples/migrations/003_create_topic.up.yql | 1 + .../ydb/examples/migrations/004_drop_column.down.yql | 2 -- .../ydb/examples/migrations/004_drop_column.up.yql | 2 -- 14 files changed, 21 insertions(+), 30 deletions(-) create mode 100644 database/ydb/examples/migrations/001_create_users.down.yql create mode 100644 database/ydb/examples/migrations/001_create_users.up.yql delete mode 100644 database/ydb/examples/migrations/001_init.down.yql delete mode 100644 database/ydb/examples/migrations/001_init.up.yql create mode 100644 database/ydb/examples/migrations/002_add_city_to_users.down.yql create mode 100644 database/ydb/examples/migrations/002_add_city_to_users.up.yql delete mode 100644 database/ydb/examples/migrations/002_test_create.down.yql delete mode 100644 database/ydb/examples/migrations/002_test_create.up.yql delete mode 100644 database/ydb/examples/migrations/003_alter_table.down.yql delete mode 100644 database/ydb/examples/migrations/003_alter_table.up.yql create mode 100644 database/ydb/examples/migrations/003_create_topic.down.yql create mode 100644 database/ydb/examples/migrations/003_create_topic.up.yql delete mode 100644 database/ydb/examples/migrations/004_drop_column.down.yql delete mode 100644 database/ydb/examples/migrations/004_drop_column.up.yql diff --git a/database/ydb/examples/migrations/001_create_users.down.yql b/database/ydb/examples/migrations/001_create_users.down.yql new file mode 100644 index 000000000..724e24df1 --- /dev/null +++ b/database/ydb/examples/migrations/001_create_users.down.yql @@ -0,0 +1 @@ +DROP TABLE `test/users`; diff --git a/database/ydb/examples/migrations/001_create_users.up.yql b/database/ydb/examples/migrations/001_create_users.up.yql new file mode 100644 index 000000000..32b13ed6e --- /dev/null +++ b/database/ydb/examples/migrations/001_create_users.up.yql @@ -0,0 +1,6 @@ +CREATE TABLE `test/users` ( + id Uint64, + name String, + email String, + PRIMARY KEY (id) +); diff --git a/database/ydb/examples/migrations/001_init.down.yql b/database/ydb/examples/migrations/001_init.down.yql deleted file mode 100644 index 9e845f2fa..000000000 --- a/database/ydb/examples/migrations/001_init.down.yql +++ /dev/null @@ -1 +0,0 @@ -DROP TABLE test_1; \ No newline at end of file diff --git a/database/ydb/examples/migrations/001_init.up.yql b/database/ydb/examples/migrations/001_init.up.yql deleted file mode 100644 index 4854e2814..000000000 --- a/database/ydb/examples/migrations/001_init.up.yql +++ /dev/null @@ -1,4 +0,0 @@ -CREATE TABLE test_1 ( - id Uint64, - PRIMARY KEY(id) -); \ No newline at end of file diff --git a/database/ydb/examples/migrations/002_add_city_to_users.down.yql b/database/ydb/examples/migrations/002_add_city_to_users.down.yql new file mode 100644 index 000000000..7ff5b3ceb --- /dev/null +++ b/database/ydb/examples/migrations/002_add_city_to_users.down.yql @@ -0,0 +1,4 @@ +DROP TABLE `test/cities`; + +ALTER TABLE `test/users` + DROP COLUMN city; diff --git a/database/ydb/examples/migrations/002_add_city_to_users.up.yql b/database/ydb/examples/migrations/002_add_city_to_users.up.yql new file mode 100644 index 000000000..83d322967 --- /dev/null +++ b/database/ydb/examples/migrations/002_add_city_to_users.up.yql @@ -0,0 +1,8 @@ +CREATE TABLE `test/cities` ( + id Uint64, + name String, + PRIMARY KEY (id) +); + +ALTER TABLE `test/users` + ADD COLUMN city Uint64; diff --git a/database/ydb/examples/migrations/002_test_create.down.yql b/database/ydb/examples/migrations/002_test_create.down.yql deleted file mode 100644 index bd97a17c6..000000000 --- a/database/ydb/examples/migrations/002_test_create.down.yql +++ /dev/null @@ -1 +0,0 @@ -DROP TABLE `meta/test_table`; diff --git a/database/ydb/examples/migrations/002_test_create.up.yql b/database/ydb/examples/migrations/002_test_create.up.yql deleted file mode 100644 index b4a8115e9..000000000 --- a/database/ydb/examples/migrations/002_test_create.up.yql +++ /dev/null @@ -1,5 +0,0 @@ -CREATE TABLE `meta/test_table` ( - id Utf8, - field Uint64, - PRIMARY KEY (id) -); diff --git a/database/ydb/examples/migrations/003_alter_table.down.yql b/database/ydb/examples/migrations/003_alter_table.down.yql deleted file mode 100644 index 4f822cb7c..000000000 --- a/database/ydb/examples/migrations/003_alter_table.down.yql +++ /dev/null @@ -1,4 +0,0 @@ -ALTER TABLE `meta/test_table` - DROP COLUMN new_field; - -DROP TABLE `meta/new_test_table`; diff --git a/database/ydb/examples/migrations/003_alter_table.up.yql b/database/ydb/examples/migrations/003_alter_table.up.yql deleted file mode 100644 index 65bad82e1..000000000 --- a/database/ydb/examples/migrations/003_alter_table.up.yql +++ /dev/null @@ -1,11 +0,0 @@ -ALTER TABLE `meta/test_table` - ADD COLUMN new_field Utf8; - -CREATE TABLE `meta/new_test_table` ( - id Utf8, - field Uint64, - PRIMARY KEY (id) -); - -ALTER TABLE `meta/new_test_table` - ADD COLUMN new_field Utf8; diff --git a/database/ydb/examples/migrations/003_create_topic.down.yql b/database/ydb/examples/migrations/003_create_topic.down.yql new file mode 100644 index 000000000..c73aaf379 --- /dev/null +++ b/database/ydb/examples/migrations/003_create_topic.down.yql @@ -0,0 +1 @@ +DROP TOPIC `test/topic`; diff --git a/database/ydb/examples/migrations/003_create_topic.up.yql b/database/ydb/examples/migrations/003_create_topic.up.yql new file mode 100644 index 000000000..70dddf256 --- /dev/null +++ b/database/ydb/examples/migrations/003_create_topic.up.yql @@ -0,0 +1 @@ +CREATE TOPIC `test/topic`; diff --git a/database/ydb/examples/migrations/004_drop_column.down.yql b/database/ydb/examples/migrations/004_drop_column.down.yql deleted file mode 100644 index f12fda0a7..000000000 --- a/database/ydb/examples/migrations/004_drop_column.down.yql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE `meta/test_table` - ADD COLUMN new_field Utf8; diff --git a/database/ydb/examples/migrations/004_drop_column.up.yql b/database/ydb/examples/migrations/004_drop_column.up.yql deleted file mode 100644 index 493cc983b..000000000 --- a/database/ydb/examples/migrations/004_drop_column.up.yql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE `meta/test_table` - DROP COLUMN new_field; From 1aa3455ab8e145ff56f5cd0f75ce686ac9e15109 Mon Sep 17 00:00:00 2001 From: Artem Murashko Date: Sat, 16 Nov 2024 01:07:00 +0300 Subject: [PATCH 16/28] add tls options --- database/ydb/README.md | 23 +++++++++++++++++------ database/ydb/ydb.go | 22 ++++++++++++++++++---- 2 files changed, 35 insertions(+), 10 deletions(-) diff --git a/database/ydb/README.md b/database/ydb/README.md index f1bae39f6..73afe974f 100644 --- a/database/ydb/README.md +++ b/database/ydb/README.md @@ -7,14 +7,25 @@ | `user` | The user to sign in as. | | `password` | The user's password. | | `host` | The host to connect to. | -| `port` | The port to bind to. | | +| `port` | The port to bind to. | | `database` | The name of the database to connect to. | -| URL Query Params | Description | -|:--------------------:|:-----------------------------------------------------------:| -| `x-auth-token` | Authentication token. | -| `x-migrations-table` | Name of the migrations table (default `schema_migrations`). | -| `x-use-grpcs` | Enables gRPCS protocol for YDB connections (default grpc). | +| URL Query Params | Description | +|:----------------------------:|:--------------------------------------------------------------------------------:| +| `x-auth-token` | Authentication token. | +| `x-migrations-table` | Name of the migrations table (default `schema_migrations`). | +| `x-use-grpcs` | Enables gRPCS protocol for YDB connections (default grpc). | +| `x-tls-ca` | The location of the CA (certificate authority) file. | +| `x-tls-insecure-skip-verify` | Controls whether a client verifies the server's certificate chain and host name. | + +### Secure connection + +Query param `x-use-grpcs` enables secure TLS connection that requires certificates. +You should declare root certificate using ENV +variable: `export YDB_SSL_ROOT_CERTIFICATES_FILE=/path/to/ydb/certs/CA.pem` or +by using `x-tls-ca` query param: `?x-tls-ca=/path/to/ydb/certs/CA.pem`. + +If `x-tls-ca` is set, goose-migrate will not use ENV variable. ### Authentication diff --git a/database/ydb/ydb.go b/database/ydb/ydb.go index d01ed4d2f..21e58a872 100644 --- a/database/ydb/ydb.go +++ b/database/ydb/ydb.go @@ -24,9 +24,11 @@ func init() { const ( defaultMigrationsTable = "schema_migrations" - queryParamAuthToken = "x-auth-token" - queryParamMigrationsTable = "x-migrations-table" - queryParamUseGRPCS = "x-use-grpcs" + queryParamAuthToken = "x-auth-token" + queryParamMigrationsTable = "x-migrations-table" + queryParamUseGRPCS = "x-use-grpcs" + queryParamTLSCertificateAuthorities = "x-tls-ca" + queryParamTLSInsecureSkipVerify = "x-tls-insecure-skip-verify" ) var ( @@ -87,8 +89,10 @@ func (db *YDB) Open(dsn string) (database.Driver, error) { } purl = migrate.FilterCustomQuery(purl) + credentials := db.parseCredentials(purl, pquery) - driver, err := ydb.Open(context.TODO(), purl.String(), credentials) + tlsOptions := db.parseTLS(purl, pquery) + driver, err := ydb.Open(context.TODO(), purl.String(), append(tlsOptions, credentials)...) if err != nil { return nil, err } @@ -117,6 +121,16 @@ func (db *YDB) parseCredentials(url *url.URL, query url.Values) (credentials ydb return credentials } +func (db *YDB) parseTLS(_ *url.URL, query url.Values) (options []ydb.Option) { + if query.Has(queryParamTLSCertificateAuthorities) { + options = append(options, ydb.WithCertificatesFromFile(query.Get(queryParamTLSCertificateAuthorities))) + } + if query.Has(queryParamTLSInsecureSkipVerify) { + options = append(options, ydb.WithTLSSInsecureSkipVerify()) + } + return options +} + func (db *YDB) Close() error { return db.driver.Close(context.TODO()) } From fecf8d7cf325945745134c46b3d517bf20324288 Mon Sep 17 00:00:00 2001 From: Artem Murashko Date: Sat, 16 Nov 2024 01:39:29 +0300 Subject: [PATCH 17/28] change readme --- database/ydb/README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/database/ydb/README.md b/database/ydb/README.md index 73afe974f..c99f383df 100644 --- a/database/ydb/README.md +++ b/database/ydb/README.md @@ -21,12 +21,10 @@ ### Secure connection Query param `x-use-grpcs` enables secure TLS connection that requires certificates. -You should declare root certificate using ENV +You can declare root certificate using ENV variable: `export YDB_SSL_ROOT_CERTIFICATES_FILE=/path/to/ydb/certs/CA.pem` or by using `x-tls-ca` query param: `?x-tls-ca=/path/to/ydb/certs/CA.pem`. -If `x-tls-ca` is set, goose-migrate will not use ENV variable. - ### Authentication By default, golang-migrate connects to YDB From 76093a121e867a24fa135f8667f5b8d088c9cdd8 Mon Sep 17 00:00:00 2001 From: Artem Murashko Date: Tue, 19 Nov 2024 13:14:34 +0300 Subject: [PATCH 18/28] support min tls version --- database/ydb/README.md | 15 ++++++++------- database/ydb/ydb.go | 35 ++++++++++++++++++++++++++++------- 2 files changed, 36 insertions(+), 14 deletions(-) diff --git a/database/ydb/README.md b/database/ydb/README.md index c99f383df..3d66356fd 100644 --- a/database/ydb/README.md +++ b/database/ydb/README.md @@ -10,13 +10,14 @@ | `port` | The port to bind to. | | `database` | The name of the database to connect to. | -| URL Query Params | Description | -|:----------------------------:|:--------------------------------------------------------------------------------:| -| `x-auth-token` | Authentication token. | -| `x-migrations-table` | Name of the migrations table (default `schema_migrations`). | -| `x-use-grpcs` | Enables gRPCS protocol for YDB connections (default grpc). | -| `x-tls-ca` | The location of the CA (certificate authority) file. | -| `x-tls-insecure-skip-verify` | Controls whether a client verifies the server's certificate chain and host name. | +| URL Query Params | Description | +|:----------------------------:|:--------------------------------------------------------------------------------------------:| +| `x-auth-token` | Authentication token. | +| `x-migrations-table` | Name of the migrations table (default `schema_migrations`). | +| `x-use-grpcs` | Enables gRPCS protocol for YDB connections (default grpc). | +| `x-tls-ca` | The location of the CA (certificate authority) file. | +| `x-tls-insecure-skip-verify` | Controls whether a client verifies the server's certificate chain and host name. | +| `x-tls-min-version` | Controls the minimum TLS version that is acceptable, use 1.0, 1.1, 1.2 or 1.3 (default 1.2). | ### Secure connection diff --git a/database/ydb/ydb.go b/database/ydb/ydb.go index 21e58a872..2833effcb 100644 --- a/database/ydb/ydb.go +++ b/database/ydb/ydb.go @@ -2,6 +2,7 @@ package ydb import ( "context" + "crypto/tls" "errors" "fmt" "io" @@ -29,11 +30,13 @@ const ( queryParamUseGRPCS = "x-use-grpcs" queryParamTLSCertificateAuthorities = "x-tls-ca" queryParamTLSInsecureSkipVerify = "x-tls-insecure-skip-verify" + queryParamTLSMinVersion = "x-tls-min-version" ) var ( - ErrNilConfig = fmt.Errorf("no config") - ErrNoDatabaseName = fmt.Errorf("no database name") + ErrNilConfig = fmt.Errorf("no config") + ErrNoDatabaseName = fmt.Errorf("no database name") + ErrUnsupportedTLSVersion = fmt.Errorf("unsupported tls version: use 1.0, 1.1, 1,2 or 1.3") ) type Config struct { @@ -90,8 +93,12 @@ func (db *YDB) Open(dsn string) (database.Driver, error) { purl = migrate.FilterCustomQuery(purl) - credentials := db.parseCredentials(purl, pquery) - tlsOptions := db.parseTLS(purl, pquery) + credentials := db.parseCredentialsOptions(purl, pquery) + tlsOptions, err := db.parseTLSOptions(purl, pquery) + if err != nil { + return nil, err + } + driver, err := ydb.Open(context.TODO(), purl.String(), append(tlsOptions, credentials)...) if err != nil { return nil, err @@ -106,7 +113,7 @@ func (db *YDB) Open(dsn string) (database.Driver, error) { return px, nil } -func (db *YDB) parseCredentials(url *url.URL, query url.Values) (credentials ydb.Option) { +func (db *YDB) parseCredentialsOptions(url *url.URL, query url.Values) (credentials ydb.Option) { switch { case query.Has(queryParamAuthToken): credentials = ydb.WithAccessTokenCredentials(query.Get(queryParamAuthToken)) @@ -121,14 +128,28 @@ func (db *YDB) parseCredentials(url *url.URL, query url.Values) (credentials ydb return credentials } -func (db *YDB) parseTLS(_ *url.URL, query url.Values) (options []ydb.Option) { +func (db *YDB) parseTLSOptions(_ *url.URL, query url.Values) (options []ydb.Option, err error) { if query.Has(queryParamTLSCertificateAuthorities) { options = append(options, ydb.WithCertificatesFromFile(query.Get(queryParamTLSCertificateAuthorities))) } if query.Has(queryParamTLSInsecureSkipVerify) { options = append(options, ydb.WithTLSSInsecureSkipVerify()) } - return options + if query.Has(queryParamTLSMinVersion) { + switch query.Get(queryParamTLSMinVersion) { + case "1.0": + options = append(options, ydb.WithMinTLSVersion(tls.VersionTLS10)) + case "1.1": + options = append(options, ydb.WithMinTLSVersion(tls.VersionTLS11)) + case "1.2": + options = append(options, ydb.WithMinTLSVersion(tls.VersionTLS12)) + case "1.3": + options = append(options, ydb.WithMinTLSVersion(tls.VersionTLS13)) + default: + return nil, ErrUnsupportedTLSVersion + } + } + return options, nil } func (db *YDB) Close() error { From bfe9fbabba88c449767892802f96f3e964f86c81 Mon Sep 17 00:00:00 2001 From: Artem Murashko Date: Sun, 8 Dec 2024 19:17:30 +0300 Subject: [PATCH 19/28] fix reviews #1 --- database/ydb/ydb.go | 13 +++++-------- database/ydb/ydb_test.go | 8 ++------ 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/database/ydb/ydb.go b/database/ydb/ydb.go index 2833effcb..3761c7d30 100644 --- a/database/ydb/ydb.go +++ b/database/ydb/ydb.go @@ -162,11 +162,8 @@ func (db *YDB) Run(migration io.Reader) error { return err } - res, err := db.driver.Scripting().Execute(context.TODO(), string(rawMigrations), nil) - if err != nil { - return err - } - return res.Close() + err = db.driver.Query().Exec(context.TODO(), string(rawMigrations), nil) + return err } func (db *YDB) SetVersion(version int, dirty bool) error { @@ -297,9 +294,9 @@ func (db *YDB) ensureVersionTable() (err error) { createVersionTableQuery := fmt.Sprintf(` CREATE TABLE IF NOT EXISTS %s ( - version Uint64, - dirty Bool, - created Timestamp, + version Uint64 NOT NULL, + dirty Bool NOT NULL, + created Timestamp NOT NULL, PRIMARY KEY(version) ) `, db.config.MigrationsTable) diff --git a/database/ydb/ydb_test.go b/database/ydb/ydb_test.go index 5bee90d5f..433ad8ee7 100644 --- a/database/ydb/ydb_test.go +++ b/database/ydb/ydb_test.go @@ -55,17 +55,13 @@ func isReady(ctx context.Context, c dktest.ContainerInfo) bool { } defer func() { _ = d.Close(ctx) }() - res, err := d.Scripting().Execute(ctx, ` + err = d.Query().Exec(ctx, ` CREATE TABLE test ( id Int, PRIMARY KEY(id) ); DROP TABLE test;`, nil) - if err != nil { - return false - } - defer func() { _ = res.Close() }() - return true + return err == nil } func Test(t *testing.T) { From 8baa73b45bb908da0f4d0fc3ea97367ece92a6cf Mon Sep 17 00:00:00 2001 From: Artem Murashko Date: Sun, 8 Dec 2024 19:50:29 +0300 Subject: [PATCH 20/28] fix reviews #2 --- database/ydb/ydb.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/database/ydb/ydb.go b/database/ydb/ydb.go index 3761c7d30..8b6721caa 100644 --- a/database/ydb/ydb.go +++ b/database/ydb/ydb.go @@ -197,7 +197,7 @@ func (db *YDB) Version() (version int, dirty bool, err error) { ctx := context.TODO() getVersionQuery := fmt.Sprintf(` - SELECT version, dirty FROM %s ORDER BY version DESC LIMIT 1 + SELECT version, dirty FROM %s LIMIT 1 `, db.config.MigrationsTable) rs, err := db.driver.Query().QueryResultSet(ctx, getVersionQuery) @@ -254,7 +254,7 @@ func (db *YDB) Drop() (err error) { return err } - dropQuery := fmt.Sprintf("DROP TABLE `%s`", table) + dropQuery := fmt.Sprintf("DROP TABLE IF EXISTS `%s`", table) if err = db.driver.Query().Exec(ctx, dropQuery); err != nil { return &database.Error{OrigErr: err, Query: []byte(dropQuery)} } From 81f152fcd32c78a9506bd79040f5a59314ca9f82 Mon Sep 17 00:00:00 2001 From: Artem Murashko Date: Sun, 15 Dec 2024 21:35:03 +0300 Subject: [PATCH 21/28] migrate to database/sql --- database/ydb/ydb.go | 205 ++++++++++++++++++++++++-------------------- 1 file changed, 112 insertions(+), 93 deletions(-) diff --git a/database/ydb/ydb.go b/database/ydb/ydb.go index 8b6721caa..e89f1a2ff 100644 --- a/database/ydb/ydb.go +++ b/database/ydb/ydb.go @@ -3,7 +3,7 @@ package ydb import ( "context" "crypto/tls" - "errors" + "database/sql" "fmt" "io" "net/url" @@ -11,15 +11,13 @@ import ( "github.com/hashicorp/go-multierror" "github.com/ydb-platform/ydb-go-sdk/v3" - "github.com/ydb-platform/ydb-go-sdk/v3/query" "github.com/golang-migrate/migrate/v4" "github.com/golang-migrate/migrate/v4/database" ) func init() { - db := YDB{} - database.Register("ydb", &db) + database.Register("ydb", &YDB{}) } const ( @@ -44,32 +42,44 @@ type Config struct { } type YDB struct { - driver *ydb.Driver - config *Config - + // locking and unlocking need to use the same connection + conn *sql.Conn + db *sql.DB isLocked atomic.Bool + + config *Config } -func WithInstance(driver *ydb.Driver, config *Config) (database.Driver, error) { +func WithInstance(instance *sql.DB, config *Config) (database.Driver, error) { if config == nil { return nil, ErrNilConfig } + if err := instance.Ping(); err != nil { + return nil, err + } + if len(config.MigrationsTable) == 0 { config.MigrationsTable = defaultMigrationsTable } + conn, err := instance.Conn(context.TODO()) + if err != nil { + return nil, err + } + db := &YDB{ - driver: driver, + conn: conn, + db: instance, config: config, } - if err := db.ensureVersionTable(); err != nil { + if err = db.ensureVersionTable(); err != nil { return nil, err } return db, nil } -func (db *YDB) Open(dsn string) (database.Driver, error) { +func (y *YDB) Open(dsn string) (database.Driver, error) { purl, err := url.Parse(dsn) if err != nil { return nil, err @@ -93,18 +103,23 @@ func (db *YDB) Open(dsn string) (database.Driver, error) { purl = migrate.FilterCustomQuery(purl) - credentials := db.parseCredentialsOptions(purl, pquery) - tlsOptions, err := db.parseTLSOptions(purl, pquery) + credentials := y.parseCredentialsOptions(purl, pquery) + tlsOptions, err := y.parseTLSOptions(purl, pquery) + if err != nil { + return nil, err + } + + nativeDriver, err := ydb.Open(context.TODO(), purl.String(), append(tlsOptions, credentials)...) if err != nil { return nil, err } - driver, err := ydb.Open(context.TODO(), purl.String(), append(tlsOptions, credentials)...) + connector, err := ydb.Connector(nativeDriver) if err != nil { return nil, err } - px, err := WithInstance(driver, &Config{ + px, err := WithInstance(sql.OpenDB(connector), &Config{ MigrationsTable: pquery.Get(queryParamMigrationsTable), }) if err != nil { @@ -113,7 +128,7 @@ func (db *YDB) Open(dsn string) (database.Driver, error) { return px, nil } -func (db *YDB) parseCredentialsOptions(url *url.URL, query url.Values) (credentials ydb.Option) { +func (y *YDB) parseCredentialsOptions(url *url.URL, query url.Values) (credentials ydb.Option) { switch { case query.Has(queryParamAuthToken): credentials = ydb.WithAccessTokenCredentials(query.Get(queryParamAuthToken)) @@ -128,7 +143,7 @@ func (db *YDB) parseCredentialsOptions(url *url.URL, query url.Values) (credenti return credentials } -func (db *YDB) parseTLSOptions(_ *url.URL, query url.Values) (options []ydb.Option, err error) { +func (y *YDB) parseTLSOptions(_ *url.URL, query url.Values) (options []ydb.Option, err error) { if query.Has(queryParamTLSCertificateAuthorities) { options = append(options, ydb.WithCertificatesFromFile(query.Get(queryParamTLSCertificateAuthorities))) } @@ -152,138 +167,143 @@ func (db *YDB) parseTLSOptions(_ *url.URL, query url.Values) (options []ydb.Opti return options, nil } -func (db *YDB) Close() error { - return db.driver.Close(context.TODO()) +func (y *YDB) Close() error { + connErr := y.conn.Close() + var dbErr error + if y.db != nil { + dbErr = y.db.Close() + } + if connErr != nil || dbErr != nil { + return fmt.Errorf("conn: %v, db: %v", connErr, dbErr) + } + return nil } -func (db *YDB) Run(migration io.Reader) error { +func (y *YDB) Run(migration io.Reader) error { rawMigrations, err := io.ReadAll(migration) if err != nil { return err } - err = db.driver.Query().Exec(context.TODO(), string(rawMigrations), nil) - return err + if _, err = y.conn.ExecContext(ydb.WithQueryMode(context.TODO(), ydb.SchemeQueryMode), string(rawMigrations)); err != nil { + return database.Error{OrigErr: err, Err: "migration failed", Query: rawMigrations} + } + return nil } -func (db *YDB) SetVersion(version int, dirty bool) error { +func (y *YDB) SetVersion(version int, dirty bool) error { deleteVersionQuery := fmt.Sprintf(` DELETE FROM %s - `, db.config.MigrationsTable) + `, y.config.MigrationsTable) insertVersionQuery := fmt.Sprintf(` INSERT INTO %s (version, dirty, created) VALUES (%d, %t, CurrentUtcTimestamp()) - `, db.config.MigrationsTable, version, dirty) + `, y.config.MigrationsTable, version, dirty) - ctx := context.TODO() - err := db.driver.Query().DoTx(ctx, func(ctx context.Context, tx query.TxActor) error { - if err := tx.Exec(ctx, deleteVersionQuery); err != nil { - return err + tx, err := y.conn.BeginTx(context.TODO(), &sql.TxOptions{}) + if err != nil { + return &database.Error{OrigErr: err, Err: "transaction start failed"} + } + + if _, err := tx.Exec(deleteVersionQuery); err != nil { + if errRollback := tx.Rollback(); errRollback != nil { + err = multierror.Append(err, errRollback) } - // Also re-write the schema version for nil dirty versions to prevent - // empty schema version for failed down migration on the first migration - // See: https://github.com/golang-migrate/migrate/issues/330 - if version >= 0 || (version == database.NilVersion && dirty) { - if err := tx.Exec(ctx, insertVersionQuery); err != nil { - return err + return &database.Error{OrigErr: err, Query: []byte(deleteVersionQuery)} + } + + // Also re-write the schema version for nil dirty versions to prevent + // empty schema version for failed down migration on the first migration + // See: https://github.com/golang-migrate/migrate/issues/330 + if version >= 0 || (version == database.NilVersion && dirty) { + if _, err := tx.Exec(insertVersionQuery, version, dirty); err != nil { + if errRollback := tx.Rollback(); errRollback != nil { + err = multierror.Append(err, errRollback) } + return &database.Error{OrigErr: err, Query: []byte(insertVersionQuery)} } - return nil - }, query.WithTxSettings(query.TxSettings(query.WithSerializableReadWrite()))) + } + + if err := tx.Commit(); err != nil { + return &database.Error{OrigErr: err, Err: "transaction commit failed"} + } return err } -func (db *YDB) Version() (version int, dirty bool, err error) { - ctx := context.TODO() - +func (y *YDB) Version() (version int, dirty bool, err error) { getVersionQuery := fmt.Sprintf(` SELECT version, dirty FROM %s LIMIT 1 - `, db.config.MigrationsTable) - - rs, err := db.driver.Query().QueryResultSet(ctx, getVersionQuery) - if err != nil { - return 0, false, &database.Error{OrigErr: err, Query: []byte(getVersionQuery)} - } - defer func() { - if closeErr := rs.Close(ctx); closeErr != nil { - err = multierror.Append(err, closeErr) - } - }() - - row, err := rs.NextRow(ctx) - if err != nil { - if errors.Is(err, io.EOF) { - return database.NilVersion, false, nil - } - return 0, false, err - } + `, y.config.MigrationsTable) var v uint64 - if err = row.Scan(&v, &dirty); err != nil { + err = y.conn.QueryRowContext(context.TODO(), getVersionQuery).Scan(&v, &dirty) + switch { + case err == sql.ErrNoRows: + return database.NilVersion, false, nil + case err != nil: return 0, false, &database.Error{OrigErr: err, Query: []byte(getVersionQuery)} + default: + return int(v), dirty, err } - return int(v), dirty, err } -func (db *YDB) Drop() (err error) { - ctx := context.TODO() - +func (y *YDB) Drop() (err error) { listQuery := "SELECT DISTINCT Path FROM `.sys/partition_stats` WHERE Path NOT LIKE '%/.sys%'" - rs, err := db.driver.Query().QueryResultSet(context.TODO(), listQuery) + rs, err := y.conn.QueryContext(context.TODO(), listQuery) if err != nil { return &database.Error{OrigErr: err, Query: []byte(listQuery)} } defer func() { - if closeErr := rs.Close(ctx); closeErr != nil { + if closeErr := rs.Close(); closeErr != nil { err = multierror.Append(err, closeErr) } }() - for { - var row query.Row - if row, err = rs.NextRow(ctx); err != nil { - if errors.Is(err, io.EOF) { - err = nil - break - } + paths := make([]string, 0) + for rs.Next() { + var path string + if err = rs.Scan(&path); err != nil { return err } - - var table string - if err = row.Scan(&table); err != nil { - return err + if len(path) != 0 { + paths = append(paths, path) } + } + if err = rs.Err(); err != nil { + return &database.Error{OrigErr: err, Query: []byte(listQuery)} + } - dropQuery := fmt.Sprintf("DROP TABLE IF EXISTS `%s`", table) - if err = db.driver.Query().Exec(ctx, dropQuery); err != nil { + for _, path := range paths { + dropQuery := fmt.Sprintf("DROP TABLE IF EXISTS `%s`", path) + if _, err = y.conn.ExecContext(ydb.WithQueryMode(context.TODO(), ydb.SchemeQueryMode), dropQuery); err != nil { return &database.Error{OrigErr: err, Query: []byte(dropQuery)} } } - - return err + return nil } -func (db *YDB) Lock() error { - if !db.isLocked.CompareAndSwap(false, true) { + +func (y *YDB) Lock() error { + if !y.isLocked.CompareAndSwap(false, true) { return database.ErrLocked } return nil } -func (db *YDB) Unlock() error { - if !db.isLocked.CompareAndSwap(true, false) { +func (y *YDB) Unlock() error { + if !y.isLocked.CompareAndSwap(true, false) { return database.ErrNotLocked } return nil } // ensureVersionTable checks if versions table exists and, if not, creates it. -func (db *YDB) ensureVersionTable() (err error) { - if err = db.Lock(); err != nil { +func (y *YDB) ensureVersionTable() (err error) { + if err = y.Lock(); err != nil { return err } defer func() { - if unlockErr := db.Unlock(); unlockErr != nil { + if unlockErr := y.Unlock(); unlockErr != nil { if err == nil { err = unlockErr } else { @@ -299,10 +319,9 @@ func (db *YDB) ensureVersionTable() (err error) { created Timestamp NOT NULL, PRIMARY KEY(version) ) - `, db.config.MigrationsTable) - err = db.driver.Query().Exec(context.TODO(), createVersionTableQuery) - if err != nil { - return err + `, y.config.MigrationsTable) + if _, err = y.conn.ExecContext(ydb.WithQueryMode(context.TODO(), ydb.SchemeQueryMode), createVersionTableQuery); err != nil { + return &database.Error{OrigErr: err, Query: []byte(createVersionTableQuery)} } - return err + return nil } From 063c1d07d100ee878d0b35437007a53b638d0300 Mon Sep 17 00:00:00 2001 From: Aleksey Myasnikov Date: Mon, 6 Jan 2025 20:39:20 +0300 Subject: [PATCH 22/28] Apply suggestions from code review --- database/ydb/ydb_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database/ydb/ydb_test.go b/database/ydb/ydb_test.go index 433ad8ee7..57baa219c 100644 --- a/database/ydb/ydb_test.go +++ b/database/ydb/ydb_test.go @@ -17,7 +17,7 @@ import ( ) const ( - image = "cr.yandex/yc/yandex-docker-local-ydb:latest" + image = "ydbplatform/local-ydb:latest" host = "localhost" port = "2136" databaseName = "local" From c2ac3bc527561f1a6b107efb393ccfbf53378228 Mon Sep 17 00:00:00 2001 From: Aleksey Myasnikov Date: Mon, 6 Jan 2025 21:30:47 +0300 Subject: [PATCH 23/28] fixes --- database/ydb/ydb.go | 9 ++++++--- go.mod | 4 ++-- go.sum | 8 ++++---- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/database/ydb/ydb.go b/database/ydb/ydb.go index e89f1a2ff..ec46839cd 100644 --- a/database/ydb/ydb.go +++ b/database/ydb/ydb.go @@ -114,18 +114,21 @@ func (y *YDB) Open(dsn string) (database.Driver, error) { return nil, err } - connector, err := ydb.Connector(nativeDriver) + connector, err := ydb.Connector(nativeDriver, + ydb.WithQueryService(true), + ) if err != nil { return nil, err } - px, err := WithInstance(sql.OpenDB(connector), &Config{ + db, err := WithInstance(sql.OpenDB(connector), &Config{ MigrationsTable: pquery.Get(queryParamMigrationsTable), }) if err != nil { return nil, err } - return px, nil + + return db, nil } func (y *YDB) parseCredentialsOptions(url *url.URL, query url.Values) (credentials ydb.Option) { diff --git a/go.mod b/go.mod index b4a5f98f6..bd4d370ff 100644 --- a/go.mod +++ b/go.mod @@ -36,7 +36,7 @@ require ( github.com/snowflakedb/gosnowflake v1.6.19 github.com/stretchr/testify v1.9.0 github.com/xanzy/go-gitlab v0.15.0 - github.com/ydb-platform/ydb-go-sdk/v3 v3.84.1 + github.com/ydb-platform/ydb-go-sdk/v3 v3.95.5 go.mongodb.org/mongo-driver v1.7.5 go.uber.org/atomic v1.7.0 golang.org/x/oauth2 v0.22.0 @@ -62,7 +62,7 @@ require ( github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect github.com/stretchr/objx v0.5.2 // indirect - github.com/ydb-platform/ydb-go-genproto v0.0.0-20241002120727-5acc94bcb119 // indirect + github.com/ydb-platform/ydb-go-genproto v0.0.0-20241112172322-ea1f63298f77 // indirect go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0 // indirect go.opentelemetry.io/otel v1.29.0 // indirect diff --git a/go.sum b/go.sum index b81bed620..873341c14 100644 --- a/go.sum +++ b/go.sum @@ -599,10 +599,10 @@ github.com/xdg-go/scram v1.1.1/go.mod h1:RaEWvsqvNKKvBPvcKeFjrG2cJqOkHTiyTpzz23n github.com/xdg-go/stringprep v1.0.2/go.mod h1:8F9zXuvzgwmyT5DUm4GUfZGDdT3W+LCvS6+da4O5kxM= github.com/xdg-go/stringprep v1.0.3 h1:kdwGpVNwPFtjs98xCGkHjQtGKh86rDcRZN17QEMCOIs= github.com/xdg-go/stringprep v1.0.3/go.mod h1:W3f5j4i+9rC0kuIEJL0ky1VpHXQU3ocBgklLGvcBnW8= -github.com/ydb-platform/ydb-go-genproto v0.0.0-20241002120727-5acc94bcb119 h1:ExSVPjuxuGuu91L0cTD2EZnMOr7VIq1vuA2dVYG0+Xc= -github.com/ydb-platform/ydb-go-genproto v0.0.0-20241002120727-5acc94bcb119/go.mod h1:Er+FePu1dNUieD+XTMDduGpQuCPssK5Q4BjF+IIXJ3I= -github.com/ydb-platform/ydb-go-sdk/v3 v3.84.1 h1:QkFhXiwoMRZTr7mxk77UeWXTCmkVXXESvncA/ug35S0= -github.com/ydb-platform/ydb-go-sdk/v3 v3.84.1/go.mod h1:BTLL5DJGTAe4sgr3sRum0OQVdNjG1cMjNwZN1qAq7eo= +github.com/ydb-platform/ydb-go-genproto v0.0.0-20241112172322-ea1f63298f77 h1:LY6cI8cP4B9rrpTleZk95+08kl2gF4rixG7+V/dwL6Q= +github.com/ydb-platform/ydb-go-genproto v0.0.0-20241112172322-ea1f63298f77/go.mod h1:Er+FePu1dNUieD+XTMDduGpQuCPssK5Q4BjF+IIXJ3I= +github.com/ydb-platform/ydb-go-sdk/v3 v3.95.5 h1:wqaTZW458sbyloRENtULUlGhVTqv/1NTObBSGCgtPNc= +github.com/ydb-platform/ydb-go-sdk/v3 v3.95.5/go.mod h1:WiezFS4YCi2vHqbYGQkeu/2MDBYFLix6dIs/pd87Yck= github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d h1:splanxYIlg+5LfHAM6xpdFEAYOk8iySO56hMFq6uLyA= github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= From 1e4515cf4995a2553051bcfe277ed6663ba03c23 Mon Sep 17 00:00:00 2001 From: Aleksey Myasnikov Date: Mon, 6 Jan 2025 21:35:43 +0300 Subject: [PATCH 24/28] reverted dependencies --- go.mod | 38 +++++++++++++-------------- go.sum | 83 +++++++++++++++++++++++++++++++--------------------------- 2 files changed, 63 insertions(+), 58 deletions(-) diff --git a/go.mod b/go.mod index bd4d370ff..56d243a18 100644 --- a/go.mod +++ b/go.mod @@ -39,7 +39,7 @@ require ( github.com/ydb-platform/ydb-go-sdk/v3 v3.95.5 go.mongodb.org/mongo-driver v1.7.5 go.uber.org/atomic v1.7.0 - golang.org/x/oauth2 v0.22.0 + golang.org/x/oauth2 v0.18.0 golang.org/x/tools v0.24.0 google.golang.org/api v0.169.0 modernc.org/ql v1.0.0 @@ -47,22 +47,18 @@ require ( ) require ( - cel.dev/expr v0.16.0 // indirect github.com/distribution/reference v0.6.0 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/jackc/puddle/v2 v2.2.1 // indirect - github.com/jonboulle/clockwork v0.4.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/kr/text v0.2.0 // indirect github.com/moby/docker-image-spec v1.3.1 // indirect github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 // indirect github.com/modern-go/reflect2 v1.0.2 // indirect - github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect github.com/stretchr/objx v0.5.2 // indirect - github.com/ydb-platform/ydb-go-genproto v0.0.0-20241112172322-ea1f63298f77 // indirect go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0 // indirect go.opentelemetry.io/otel v1.29.0 // indirect @@ -75,7 +71,8 @@ require ( require ( cloud.google.com/go v0.112.1 // indirect - cloud.google.com/go/compute/metadata v0.5.0 // indirect + cloud.google.com/go/compute v1.25.1 // indirect + cloud.google.com/go/compute/metadata v0.2.3 // indirect cloud.google.com/go/iam v1.1.6 // indirect cloud.google.com/go/longrunning v0.5.5 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect @@ -106,24 +103,24 @@ require ( github.com/aws/aws-sdk-go-v2/service/s3 v1.27.11 // indirect github.com/aws/smithy-go v1.13.3 // indirect github.com/census-instrumentation/opencensus-proto v0.4.1 // indirect - github.com/cespare/xxhash/v2 v2.3.0 // indirect + github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/cloudflare/golz4 v0.0.0-20150217214814-ef862a3cdc58 // indirect - github.com/cncf/xds/go v0.0.0-20240723142845-024c85f92f20 // indirect + github.com/cncf/xds/go v0.0.0-20240318125728-8a4994d93e50 // indirect github.com/cznic/mathutil v0.0.0-20180504122225-ca4c9f2c1369 // indirect github.com/danieljoos/wincred v1.1.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/docker/go-units v0.5.0 // indirect github.com/dvsekhvalnov/jose2go v1.6.0 // indirect github.com/edsrzf/mmap-go v0.0.0-20170320065105-0bce6a688712 // indirect - github.com/envoyproxy/go-control-plane v0.13.0 // indirect - github.com/envoyproxy/protoc-gen-validate v1.1.0 // indirect + github.com/envoyproxy/go-control-plane v0.12.0 // indirect + github.com/envoyproxy/protoc-gen-validate v1.0.4 // indirect github.com/form3tech-oss/jwt-go v3.2.5+incompatible // indirect github.com/gabriel-vasile/mimetype v1.4.1 // indirect github.com/go-stack/stack v1.8.0 // indirect github.com/goccy/go-json v0.9.11 // indirect github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect github.com/gogo/protobuf v1.3.2 // indirect - github.com/golang-jwt/jwt/v4 v4.5.0 // indirect + github.com/golang-jwt/jwt/v4 v4.4.2 // indirect github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe // indirect github.com/golang-sql/sqlexp v0.1.0 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect @@ -180,21 +177,22 @@ require ( github.com/zeebo/xxh3 v1.0.2 // indirect gitlab.com/nyarla/go-crypt v0.0.0-20160106005555-d9a5dc2b789b // indirect go.opencensus.io v0.24.0 // indirect - golang.org/x/crypto v0.28.0 // indirect + golang.org/x/crypto v0.27.0 // indirect golang.org/x/exp v0.0.0-20230315142452-642cacee5cc0 // indirect golang.org/x/mod v0.21.0 // indirect - golang.org/x/net v0.30.0 // indirect + golang.org/x/net v0.29.0 // indirect golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.26.0 // indirect - golang.org/x/term v0.25.0 // indirect - golang.org/x/text v0.19.0 // indirect + golang.org/x/sys v0.25.0 // indirect + golang.org/x/term v0.24.0 // indirect + golang.org/x/text v0.18.0 // indirect golang.org/x/time v0.5.0 // indirect golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect + google.golang.org/appengine v1.6.8 // indirect google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20241015192408-796eee8c2d53 // indirect - google.golang.org/grpc v1.67.1 // indirect - google.golang.org/protobuf v1.35.1 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240513163218-0867130af1f8 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240513163218-0867130af1f8 // indirect + google.golang.org/grpc v1.64.1 // indirect + google.golang.org/protobuf v1.34.2 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect lukechampine.com/uint128 v1.2.0 // indirect diff --git a/go.sum b/go.sum index 873341c14..6552b9415 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,3 @@ -cel.dev/expr v0.16.0 h1:yloc84fytn4zmJX2GU3TkXGsaieaV7dQ057Qs4sIG2Y= -cel.dev/expr v0.16.0/go.mod h1:TRSuuV7DlVCE/uwv5QbAiW/v8l5O8C4eEPHeu7gf7Sg= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= @@ -12,8 +10,10 @@ cloud.google.com/go v0.112.1 h1:uJSeirPke5UNZHIb4SxfZklVSiWWVqW4oXlETwZziwM= cloud.google.com/go v0.112.1/go.mod h1:+Vbu+Y1UU+I1rjmzeMOb/8RfkKJK2Gyxi1X6jJCZLo4= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= -cloud.google.com/go/compute/metadata v0.5.0 h1:Zr0eK8JbFv6+Wi4ilXAR8FJ3wyNdpxHKJNPos6LTZOY= -cloud.google.com/go/compute/metadata v0.5.0/go.mod h1:aHnloV2TPI38yx4s9+wAZhHykWvVCfu7hQbF+9CWoiY= +cloud.google.com/go/compute v1.25.1 h1:ZRpHJedLtTpKgr3RV1Fx23NuaAEN1Zfx9hw1u4aJdjU= +cloud.google.com/go/compute v1.25.1/go.mod h1:oopOIR53ly6viBYxaDhBfJwzUAxf1zE//uf3IB011ls= +cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= +cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/iam v1.1.6 h1:bEa06k05IO4f4uJonbB5iAgKTPpABy1ayxaIZV/GHVc= cloud.google.com/go/iam v1.1.6/go.mod h1:O0zxdPeGBoFdWW3HWmBxJsk0pfvNM/p/qa82rWOGTwI= @@ -128,8 +128,8 @@ github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA github.com/census-instrumentation/opencensus-proto v0.4.1 h1:iKLQ0xPNFxR/2hzXZMrBo8f1j86j5WHzznCCQxV/b8g= github.com/census-instrumentation/opencensus-proto v0.4.1/go.mod h1:4T9NM4+4Vw91VeyqjLS6ao50K5bOcLKN6Q42XnYaRYw= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= -github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= +github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cloudflare/golz4 v0.0.0-20150217214814-ef862a3cdc58 h1:F1EaeKL/ta07PY/k9Os/UFtwERei2/XzGemhpGnBKNg= github.com/cloudflare/golz4 v0.0.0-20150217214814-ef862a3cdc58/go.mod h1:EOBUe0h4xcZ5GoxqC5SDxFQ8gwyZPKQoEzownBlhI80= @@ -139,8 +139,8 @@ github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XP github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20240723142845-024c85f92f20 h1:N+3sFI5GUjRKBi+i0TxYVST9h4Ie192jJWpHvthBBgg= -github.com/cncf/xds/go v0.0.0-20240723142845-024c85f92f20/go.mod h1:W+zGtBO5Y1IgJhy4+A9GOqVhqLpfZi+vwmdNXUehLA8= +github.com/cncf/xds/go v0.0.0-20240318125728-8a4994d93e50 h1:DBmgJDC9dTfkVyGgipamEh2BpGYxScCH1TOF1LL1cXc= +github.com/cncf/xds/go v0.0.0-20240318125728-8a4994d93e50/go.mod h1:5e1+Vvlzido69INQaVO6d87Qn543Xr6nooe9Kz7oBFM= github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I= github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= github.com/cockroachdb/cockroach-go/v2 v2.1.1 h1:3XzfSMuUT0wBe1a3o5C0eOTcArhmmFAg2Jzh/7hhKqo= @@ -184,11 +184,11 @@ github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.m github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= -github.com/envoyproxy/go-control-plane v0.13.0 h1:HzkeUz1Knt+3bK+8LG1bxOO/jzWZmdxpwC51i202les= -github.com/envoyproxy/go-control-plane v0.13.0/go.mod h1:GRaKG3dwvFoTg4nj7aXdZnvMg4d7nvT/wl9WgVXn3Q8= +github.com/envoyproxy/go-control-plane v0.12.0 h1:4X+VP1GHd1Mhj6IB5mMeGbLCleqxjletLK6K0rbxyZI= +github.com/envoyproxy/go-control-plane v0.12.0/go.mod h1:ZBTaoJ23lqITozF0M6G4/IragXCQKCnYbmlmtHvwRG0= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/envoyproxy/protoc-gen-validate v1.1.0 h1:tntQDh69XqOCOZsDz0lVJQez/2L6Uu2PdjCQwWCJ3bM= -github.com/envoyproxy/protoc-gen-validate v1.1.0/go.mod h1:sXRDRVmzEbkM7CVcM06s9shE/m23dg3wzjl0UWqJ2q4= +github.com/envoyproxy/protoc-gen-validate v1.0.4 h1:gVPz/FMfvh57HdSJQyvBtF00j8JU4zdyUgIUNhlgg0A= +github.com/envoyproxy/protoc-gen-validate v1.0.4/go.mod h1:qys6tmnRsYrQqIhm2bvKZH4Blx/1gTIZ2UKVY1M+Yew= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/form3tech-oss/jwt-go v3.2.5+incompatible h1:/l4kBbb4/vGSsdtB5nUe8L7B9mImVMaBPw9L/0TBHU8= @@ -230,9 +230,8 @@ github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRx github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang-jwt/jwt/v4 v4.0.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= +github.com/golang-jwt/jwt/v4 v4.4.2 h1:rcc4lwaZgFMCZ5jxF9ABolDcIHdBytAFgqFPbSJQAYs= github.com/golang-jwt/jwt/v4 v4.4.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= -github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= -github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe h1:lXe2qZdvpiX5WZkZR4hgp4KJVfY3nMkvmwbVkpv1rVY= github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0= github.com/golang-sql/sqlexp v0.1.0 h1:ZCD6MBpcuOVfGVqsEmY5/4FtYiKz6tSyUv9LPEDei6A= @@ -417,8 +416,8 @@ github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGw github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= github.com/jmoiron/sqlx v1.2.0/go.mod h1:1FEQNm3xlJgrMD+FBdI9+xvCksHtbpVBBw5dYhBSsks= github.com/jmoiron/sqlx v1.3.1/go.mod h1:2BljVx/86SuTyjE+aPYlHCTNvZrnJXghYGpNiXLBMCQ= -github.com/jonboulle/clockwork v0.4.0 h1:p4Cf1aMWXnXAUh8lVfewRBx1zaTSYKrKMF2g3ST4RZ4= -github.com/jonboulle/clockwork v0.4.0/go.mod h1:xgRqUGwRcjKCO1vbZUEtSLrqKoPSsUpK7fnezOII0kc= +github.com/jonboulle/clockwork v0.3.0 h1:9BSCMi8C+0qdApAp4auwX0RkLGUjs956h0EkuQymUhg= +github.com/jonboulle/clockwork v0.3.0/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= @@ -539,8 +538,6 @@ github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzL github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 h1:GFCKgmp0tecUJ0sJuv4pzYCqS9+RGSn52M3FUwPs+uo= -github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10/go.mod h1:t/avpk3KcrXxUnYOhZhMXJlSEyie6gQbtLq5NM3loB8= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= @@ -607,6 +604,7 @@ github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d h1:splanxYIlg+5LfHAM github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/zeebo/assert v1.3.0 h1:g7C04CbJuIDKNPFHmsk4hwZDO5O+kntRxzaUoNXj+IQ= github.com/zeebo/assert v1.3.0/go.mod h1:Pq9JiuJQpG8JLJdtkwrJESF0Foym2/D9XMU5ciN/wJ0= github.com/zeebo/xxh3 v1.0.2 h1:xZmwmqxHZA8AI603jOQ0tMqmBr9lPeFwGg6d+xy9DC0= @@ -672,10 +670,11 @@ golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw= -golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U= +golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= +golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -702,6 +701,7 @@ golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0= golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -733,8 +733,9 @@ golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= -golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= +golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= golang.org/x/oauth2 v0.0.0-20180227000427-d7d64896b5ff/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181106182150-f42d05182288/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -742,8 +743,8 @@ golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4Iltr golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.22.0 h1:BzDx2FehcG7jJwgWLELCdmLuxk2i+x9UDpSiss2u0ZA= -golang.org/x/oauth2 v0.22.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= +golang.org/x/oauth2 v0.18.0 h1:09qnuIAgzdx1XplqJvW6CQqMCtGZykZWcXzPMPUusvI= +golang.org/x/oauth2 v0.18.0/go.mod h1:Wf7knwG0MPoWIMMBgFlEaSUDaKskp0dCfrlJRJXbBi8= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -751,6 +752,7 @@ golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180224232135-f6cff0780e54/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -793,14 +795,15 @@ golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220224120231-95c6836cb0e7/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= -golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= +golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.25.0 h1:WtHI/ltw4NvSUig5KARz9h521QvRC8RmF/cuYqifU24= -golang.org/x/term v0.25.0/go.mod h1:RPyXicDX+6vLxogjjRxjgD2TKtmAO6NZBsBRfrOLu7M= +golang.org/x/term v0.24.0 h1:Mh5cbb+Zk2hqqXNO7S1iTjEphVL+jb8ZWaqh/g+JWkM= +golang.org/x/term v0.24.0/go.mod h1:lOBK/LVxemqiMij05LGJ0tzNr8xlmwBRJ81PX6wVLH8= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -810,8 +813,9 @@ golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= -golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= +golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= +golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= @@ -847,6 +851,7 @@ golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roY golang.org/x/tools v0.0.0-20201124115921-2c860bdd6e78/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.24.0 h1:J1shsA93PJUEVaUSaay7UXAyE8aimq3GW0pjlolpa24= golang.org/x/tools v0.24.0/go.mod h1:YhNqVBIfWHdzvTLs0d8LCuMhkKUgSUKldakyV7W/WDQ= golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -876,6 +881,8 @@ google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7 google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM= +google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= @@ -892,10 +899,10 @@ google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfG google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9 h1:9+tzLLstTlPTRyJTh+ah5wIMsBW5c4tQwGTN3thOW9Y= google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9/go.mod h1:mqHbVIp48Muh7Ywss/AD6I5kNVKZMmAa/QEW58Gxp2s= -google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 h1:wKguEg1hsxI2/L3hUYrpo1RVi48K+uTyzKqprwLXsb8= -google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142/go.mod h1:d6be+8HhtEtucleCbxpPW9PA9XwISACu8nvpPqF0BVo= -google.golang.org/genproto/googleapis/rpc v0.0.0-20241015192408-796eee8c2d53 h1:X58yt85/IXCx0Y3ZwN6sEIKZzQtDEYaBWrDvErdXrRE= -google.golang.org/genproto/googleapis/rpc v0.0.0-20241015192408-796eee8c2d53/go.mod h1:GX3210XPVPUjJbTUbvwI8f2IpZDMZuPJWDzDuebbviI= +google.golang.org/genproto/googleapis/api v0.0.0-20240513163218-0867130af1f8 h1:W5Xj/70xIA4x60O/IFyXivR5MGqblAb8R3w26pnD6No= +google.golang.org/genproto/googleapis/api v0.0.0-20240513163218-0867130af1f8/go.mod h1:vPrPUTsDCYxXWjP7clS81mZ6/803D8K4iM9Ma27VKas= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240513163218-0867130af1f8 h1:mxSlqyb8ZAHsYDCfiXN1EDdNTdvjUJSLY+OnAUtYNYA= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240513163218-0867130af1f8/go.mod h1:I7Y+G38R2bu5j1aLzfFmQfTcU/WnFuqDwLZAbvKTKpM= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -907,8 +914,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.47.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= -google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E= -google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= +google.golang.org/grpc v1.64.1 h1:LKtvyfbX3UGVPFcGqJ9ItpVWW6oN/2XqTxfAnwRRXiA= +google.golang.org/grpc v1.64.1/go.mod h1:hiQF4LFZelK2WKaP6W0L92zGHtiQdZxk8CrSdvyjeP0= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -922,8 +929,8 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= -google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= +google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= +google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= From b5aa72fc76f2b8cf761404fa6525dd09afb8dec0 Mon Sep 17 00:00:00 2001 From: Aleksey Myasnikov Date: Mon, 6 Jan 2025 21:42:50 +0300 Subject: [PATCH 25/28] fixed env --- database/ydb/ydb_test.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/database/ydb/ydb_test.go b/database/ydb/ydb_test.go index 57baa219c..e9b6d2099 100644 --- a/database/ydb/ydb_test.go +++ b/database/ydb/ydb_test.go @@ -26,7 +26,9 @@ const ( var ( opts = dktest.Options{ Env: map[string]string{ - "YDB_USE_IN_MEMORY_PDISKS": "true", + "GRPC_TLS_PORT": "2135", + "GRPC_PORT": "2136", + "MON_PORT": "8765", }, PortBindings: nat.PortMap{ From 744dd5eceb596688d65bbddf94d986d914066f1b Mon Sep 17 00:00:00 2001 From: Aleksey Myasnikov Date: Mon, 6 Jan 2025 21:53:22 +0300 Subject: [PATCH 26/28] go mod tidy --- go.mod | 2 ++ 1 file changed, 2 insertions(+) diff --git a/go.mod b/go.mod index 56d243a18..ee86b5602 100644 --- a/go.mod +++ b/go.mod @@ -52,6 +52,7 @@ require ( github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/jackc/puddle/v2 v2.2.1 // indirect + github.com/jonboulle/clockwork v0.3.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/kr/text v0.2.0 // indirect github.com/moby/docker-image-spec v1.3.1 // indirect @@ -59,6 +60,7 @@ require ( github.com/modern-go/reflect2 v1.0.2 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect github.com/stretchr/objx v0.5.2 // indirect + github.com/ydb-platform/ydb-go-genproto v0.0.0-20241112172322-ea1f63298f77 // indirect go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0 // indirect go.opentelemetry.io/otel v1.29.0 // indirect From 5444c1e0c9284f69196c4383053926e3ac129261 Mon Sep 17 00:00:00 2001 From: Aleksey Myasnikov Date: Tue, 7 Jan 2025 00:39:55 +0300 Subject: [PATCH 27/28] rename yql to sql --- .../{001_create_users.down.yql => 001_create_users.down.sql} | 0 .../{001_create_users.up.yql => 001_create_users.up.sql} | 0 ..._add_city_to_users.down.yql => 002_add_city_to_users.down.sql} | 0 ...{002_add_city_to_users.up.yql => 002_add_city_to_users.up.sql} | 0 .../{003_create_topic.down.yql => 003_create_topic.down.sql} | 0 .../{003_create_topic.up.yql => 003_create_topic.up.sql} | 0 6 files changed, 0 insertions(+), 0 deletions(-) rename database/ydb/examples/migrations/{001_create_users.down.yql => 001_create_users.down.sql} (100%) rename database/ydb/examples/migrations/{001_create_users.up.yql => 001_create_users.up.sql} (100%) rename database/ydb/examples/migrations/{002_add_city_to_users.down.yql => 002_add_city_to_users.down.sql} (100%) rename database/ydb/examples/migrations/{002_add_city_to_users.up.yql => 002_add_city_to_users.up.sql} (100%) rename database/ydb/examples/migrations/{003_create_topic.down.yql => 003_create_topic.down.sql} (100%) rename database/ydb/examples/migrations/{003_create_topic.up.yql => 003_create_topic.up.sql} (100%) diff --git a/database/ydb/examples/migrations/001_create_users.down.yql b/database/ydb/examples/migrations/001_create_users.down.sql similarity index 100% rename from database/ydb/examples/migrations/001_create_users.down.yql rename to database/ydb/examples/migrations/001_create_users.down.sql diff --git a/database/ydb/examples/migrations/001_create_users.up.yql b/database/ydb/examples/migrations/001_create_users.up.sql similarity index 100% rename from database/ydb/examples/migrations/001_create_users.up.yql rename to database/ydb/examples/migrations/001_create_users.up.sql diff --git a/database/ydb/examples/migrations/002_add_city_to_users.down.yql b/database/ydb/examples/migrations/002_add_city_to_users.down.sql similarity index 100% rename from database/ydb/examples/migrations/002_add_city_to_users.down.yql rename to database/ydb/examples/migrations/002_add_city_to_users.down.sql diff --git a/database/ydb/examples/migrations/002_add_city_to_users.up.yql b/database/ydb/examples/migrations/002_add_city_to_users.up.sql similarity index 100% rename from database/ydb/examples/migrations/002_add_city_to_users.up.yql rename to database/ydb/examples/migrations/002_add_city_to_users.up.sql diff --git a/database/ydb/examples/migrations/003_create_topic.down.yql b/database/ydb/examples/migrations/003_create_topic.down.sql similarity index 100% rename from database/ydb/examples/migrations/003_create_topic.down.yql rename to database/ydb/examples/migrations/003_create_topic.down.sql diff --git a/database/ydb/examples/migrations/003_create_topic.up.yql b/database/ydb/examples/migrations/003_create_topic.up.sql similarity index 100% rename from database/ydb/examples/migrations/003_create_topic.up.yql rename to database/ydb/examples/migrations/003_create_topic.up.sql From 8d20ea167e962844d9e061087cc16aec5c7c7159 Mon Sep 17 00:00:00 2001 From: Aleksey Myasnikov Date: Tue, 7 Jan 2025 01:11:08 +0300 Subject: [PATCH 28/28] more sql-migrations --- .../ydb/examples/migrations/002_add_city_to_users.down.sql | 3 +-- .../ydb/examples/migrations/002_add_city_to_users.up.sql | 3 +-- .../migrations/004_add_index_on_user_emails.down.sql | 1 + .../examples/migrations/004_add_index_on_user_emails.up.sql | 1 + .../ydb/examples/migrations/005_create_books_table.down.sql | 1 + .../ydb/examples/migrations/005_create_books_table.up.sql | 6 ++++++ .../examples/migrations/006_create_movies_table.down.sql | 1 + .../ydb/examples/migrations/006_create_movies_table.up.sql | 6 ++++++ 8 files changed, 18 insertions(+), 4 deletions(-) create mode 100644 database/ydb/examples/migrations/004_add_index_on_user_emails.down.sql create mode 100644 database/ydb/examples/migrations/004_add_index_on_user_emails.up.sql create mode 100644 database/ydb/examples/migrations/005_create_books_table.down.sql create mode 100644 database/ydb/examples/migrations/005_create_books_table.up.sql create mode 100644 database/ydb/examples/migrations/006_create_movies_table.down.sql create mode 100644 database/ydb/examples/migrations/006_create_movies_table.up.sql diff --git a/database/ydb/examples/migrations/002_add_city_to_users.down.sql b/database/ydb/examples/migrations/002_add_city_to_users.down.sql index 7ff5b3ceb..7c04425df 100644 --- a/database/ydb/examples/migrations/002_add_city_to_users.down.sql +++ b/database/ydb/examples/migrations/002_add_city_to_users.down.sql @@ -1,4 +1,3 @@ DROP TABLE `test/cities`; -ALTER TABLE `test/users` - DROP COLUMN city; +ALTER TABLE `test/users` DROP COLUMN city; diff --git a/database/ydb/examples/migrations/002_add_city_to_users.up.sql b/database/ydb/examples/migrations/002_add_city_to_users.up.sql index 83d322967..c21ce827e 100644 --- a/database/ydb/examples/migrations/002_add_city_to_users.up.sql +++ b/database/ydb/examples/migrations/002_add_city_to_users.up.sql @@ -4,5 +4,4 @@ CREATE TABLE `test/cities` ( PRIMARY KEY (id) ); -ALTER TABLE `test/users` - ADD COLUMN city Uint64; +ALTER TABLE `test/users` ADD COLUMN city Uint64; diff --git a/database/ydb/examples/migrations/004_add_index_on_user_emails.down.sql b/database/ydb/examples/migrations/004_add_index_on_user_emails.down.sql new file mode 100644 index 000000000..09ee4edd7 --- /dev/null +++ b/database/ydb/examples/migrations/004_add_index_on_user_emails.down.sql @@ -0,0 +1 @@ +ALTER TABLE `test/users` DROP INDEX `users_email_index`; diff --git a/database/ydb/examples/migrations/004_add_index_on_user_emails.up.sql b/database/ydb/examples/migrations/004_add_index_on_user_emails.up.sql new file mode 100644 index 000000000..f6a76017d --- /dev/null +++ b/database/ydb/examples/migrations/004_add_index_on_user_emails.up.sql @@ -0,0 +1 @@ +ALTER TABLE `test/users` ADD INDEX `users_email_index` GLOBAL UNIQUE ON (`email`); diff --git a/database/ydb/examples/migrations/005_create_books_table.down.sql b/database/ydb/examples/migrations/005_create_books_table.down.sql new file mode 100644 index 000000000..0253dd2db --- /dev/null +++ b/database/ydb/examples/migrations/005_create_books_table.down.sql @@ -0,0 +1 @@ +DROP TABLE `test/books`; diff --git a/database/ydb/examples/migrations/005_create_books_table.up.sql b/database/ydb/examples/migrations/005_create_books_table.up.sql new file mode 100644 index 000000000..3adc7b076 --- /dev/null +++ b/database/ydb/examples/migrations/005_create_books_table.up.sql @@ -0,0 +1,6 @@ +CREATE TABLE `test/books` ( + user_id Uint64, + name Text, + author Text, + PRIMARY KEY (user_id) +); diff --git a/database/ydb/examples/migrations/006_create_movies_table.down.sql b/database/ydb/examples/migrations/006_create_movies_table.down.sql new file mode 100644 index 000000000..c6e87f8c1 --- /dev/null +++ b/database/ydb/examples/migrations/006_create_movies_table.down.sql @@ -0,0 +1 @@ +DROP TABLE `test/movies`; diff --git a/database/ydb/examples/migrations/006_create_movies_table.up.sql b/database/ydb/examples/migrations/006_create_movies_table.up.sql new file mode 100644 index 000000000..6aa837f51 --- /dev/null +++ b/database/ydb/examples/migrations/006_create_movies_table.up.sql @@ -0,0 +1,6 @@ +CREATE TABLE `test/movies` ( + user_id Uint64, + name Text, + director Text, + PRIMARY KEY (user_id) +);