Skip to content
This repository has been archived by the owner on Mar 1, 2023. It is now read-only.

Migration guide

Dmitriy Pleshevskiy edited this page Jul 18, 2022 · 1 revision

Ingest

Push

Basic usage

v0.x.x

// use sonic_channel::*;
channel.push(collection, bucket, object, text);

v1.x.x

// use sonic_channel::*;
let dest = Dest::col_buc(collection, bucket);
channel.push(PushRequest::new(dest.obj(object), text));

With locale

v0.x.x

// use sonic_channel::*;
channel.push_with_locale(collection, bucket, object, text, "rus");

v1.x.x

// use sonic_channel::*;
let dest = Dest::col_buc(collection, bucket);
channel.push(PushRequest::new(dest.obj(object), text).lang(Lang::Rus));

Pop

v0.x.x

// use sonic_channel::*;
channel.pop(collection, bucket, object, text);

v1.x.x

// use sonic_channel::*;
let dest = Dest::col_buc(collection, bucket);
channel.pop(PopRequest::new(dest.obj(object), text));

Flush

Collection (Flushc)

v0.x.x

// use sonic_channel::*;
channel.flushc(collection);

v1.x.x

// use sonic_channel::*;
channel.flush(FlushRequest::collection(collection));
// or use Dest
let dest = Dest::col(collection);
channel.flush(dest.into());

Bucket (Flushb)

v0.x.x

// use sonic_channel::*;
channel.flushb(collection, bucket);

v1.x.x

// use sonic_channel::*;
channel.flush(FlushRequest::bucket(collection, bucket));
// or use Dest
let dest = Dest::col_buc(collection, bucket);
channel.flush(dest.into());

Object (Flusho)

v0.x.x

// use sonic_channel::*;
channel.flusho(collection, bucket, object);

v1.x.x

// use sonic_channel::*;
channel.flush(FlushRequest::object(collection, bucket, object));
// or use ObjDest
let dest = Dest::col_buc(collection, bucket).obj(object);
channel.flush(dest.into());

Count

Buckets

v0.x.x

// use sonic_channel::*;
channel.bucket_count(collection);

v1.x.x

// use sonic_channel::*;
channel.count(CountRequest::buckets(collection));
// or use Dest
let dest = Dest::col(collection);
channel.count(dest.into());

Objects

v0.x.x

// use sonic_channel::*;
channel.object_count(collection, bucket);

v1.x.x

// use sonic_channel::*;
channel.count(CountRequest::objects(collection, bucket));
// or use Dest
let dest = Dest::col_buc(collection, bucket);
channel.count(dest.into());

Words

v0.x.x

// use sonic_channel::*;
channel.word_count(collection, bucket, object);

v1.x.x

// use sonic_channel::*;
channel.count(CountRequest::words(collection, bucket, object));
// or use ObjDest
let dest = Dest::col_buc(collection, bucket).obj(object);
channel.count(dest.into());

Search

Query

Basic usage

v0.x.x

// use sonic_channel::*;
channel.query(collection, bucket, text);

v1.x.x

// use sonic_channel::*;
let dest = Dest::col_buc(collection, bucket);
channel.query(QueryRequest::new(dest, text));

Limited

v0.x.x

// use sonic_channel::*;
channel.query_with_limit(collection, bucket, text, limit);

v1.x.x

// use sonic_channel::*;
let dest = Dest::col_buc(collection, bucket);
channel.query(QueryRequest::new(dest, text).limit(limit));

Paginated

v0.x.x

// use sonic_channel::*;
channel.query_with_limit_and_offset(collection, bucket, text, limit, offset);

v1.x.x

// use sonic_channel::*;
let dest = Dest::col_buc(collection, bucket);
channel.query(QueryRequest::new(dest, text).offset(offset).limit(limit));
// or use the `pag`. Note: the first parameter is a page.
channel.query(QueryRequest::new(dest, text).pag(offset / limit, limit));

Suggest

Basic usage

v0.x.x

// use sonic_channel::*;
channel.suggest(collection, bucket, input);

v1.x.x

// use sonic_channel::*;
let dest = Dest::col_buc(collection, bucket);
channel.suggest(SuggestRequest::new(dest, input));

Limited

v0.x.x

// use sonic_channel::*;
channel.suggest_with_limit(collection, bucket, input, limit);

v1.x.x

// use sonic_channel::*;
let dest = Dest::col_buc(collection, bucket);
channel.suggest(SuggestRequest::new(dest, text).limit(limit));