surrealdb 0.4.3 copy "surrealdb: ^0.4.3" to clipboard
surrealdb: ^0.4.3 copied to clipboard

outdated

SurrealDB client written in pure dart. auto reconnect, typed functions

example/example.dart

import 'package:surrealdb/src/surrealdb.dart';
import 'package:surrealdb/surrealdb.dart';

void main(List<String> args) async {
  var client = SurrealDB('ws://localhost:8000/rpc');

  client.connect();
  await client.wait();

  await client.use('test', 'test');

  await client.signin('root', 'root');

  await client.create('person', PersonModel(false, 'Title'));

  await client.create('person', {
    'title': 'Founder & CEO',
    'name': {
      'first': 'Tobie',
      'last': 'Morgan Hitchcock',
    },
    'marketing': false,
  });

  await client.select('person');

  await client.query(
    'SELECT marketing, count() FROM type::table(\$tb) GROUP BY marketing',
    {
      'tb': 'person',
    },
  );

  await client.live('person');

  await client.query('live select * from person');
}

class PersonModel {
  final bool marketing;
  final String title;

  PersonModel(this.marketing, this.title);

  static fromJson(Map<String, dynamic> json) {
    return PersonModel(json['marketing'], json['title']);
  }
}
33
likes
0
pub points
66%
popularity

Publisher

verified publisherduhanbalci.com

SurrealDB client written in pure dart. auto reconnect, typed functions

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

web_socket_channel

More

Packages that depend on surrealdb