use JSON::Class;
use JSON::Name;
use JSON::Unmarshal;

class CouchDB::Database does JSON::Class {
    sub microsecs-to-dt($val) returns DateTime {
        DateTime.new(($val.Numeric/1000000).Int);
    }
    has Int         $.doc_del_count;
    has Int         $.disk_format_version;
    has Int         $.committed_update_seq;
    has Int         $.purge_seq;
    has Int         $.doc_count;
    has Bool        $.compact_running;
    has Int         $.disk_size;
    has Int         $.data_size;
    has DateTime    $.instance_start_time is unmarshalled-by(&microsecs-to-dt);
    has Int         $.update_seq;
    has Str         $.db_name;
}

# vim: expandtab shiftwidth=4 ft=perl6

use JSON::Class;
use JSON::Name;
use JSON::Unmarshal;

class CouchDB::Database does JSON::Class {
    sub microsecs-to-dt($val) returns DateTime {
        DateTime.new(($val.Numeric/1000000).Int);
    }
    has Int         $.doc_del_count;
    has Int         $.disk_format_version;
    has Int         $.committed_update_seq;
    has Int         $.purge_seq;
    has Int         $.doc_count;
    has Bool        $.compact_running;
    has Int         $.disk_size;
    has Int         $.data_size;
    has DateTime    $.instance_start_time is unmarshalled-by(&microsecs-to-dt);
    has Int         $.update_seq;
    has Str         $.db_name;

	our token valid-db-name {
		^<[a .. z]><[a .. z0 .. 9_$()+/-]>*$
	}
}

# vim: expandtab shiftwidth=4 ft=perl6

Add a regular expression to validate db name
Add a regular expression to validate db name
