dutils-data 1.1.1

Convert structs to/from and JSON/BSON with validation


To use this package, run the following command in your project's root directory:

Manual usage
Put the following dependency into your project's dependences section:

data

DUB Package Posix Build Status

Conversion between structs and BSON/JSON with validation

example

import std.stdio : writeln;

import vibe.data.json : Json;

import dutils.validation.constraints : ValidateRequired, ValidateEmail;
import dutils.data.json : fromJson;

struct Email {
  @ValidateRequired()
  @ValidateEmail()
  string to;

  @ValidateEmail()
  string from;

  string subject;

  @ValidateRequired()
  string body;
}

auto data = Json([
  "does not exists": Json(true),
  "to": Json("[email protected]"),
  "body": Json("Some text")
]);

Email email;
fromJson(email, data);

writeln("email: ", email);
Authors:
  • Fredrik Söderström
Dependencies:
vibe-d, dutils-validation
Versions:
2.0.1 2020-May-14
2.0.0 2020-May-12
1.1.1 2020-May-12
1.1.0 2020-May-12
~master 2020-May-16
Show all 5 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 0 downloads this month

  • 95 downloads total

Score:
0.6
Short URL:
dutils-data.dub.pm