authors | date | description | keywords | license | slug | title | type | lastmod | project | version | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
2023-07-02 20:00:10 UTC |
This package contains several *primitive* types that are used throughout the rest of the Types package. |
|
MIT |
primitives |
DGMJR-IO Primitives |
readme |
2023-07-02 22:36:04 UTC |
Dgmjr.Types |
0.0.1 |
This package contains several "primitive" types that are used throughout the rest of the Types package.
EmailAddress
- An email address value type
The EmailAddress
struct represents an email address value. It aims to encapsulate email address parsing, validation, and formatting logic in a reusable way.
Key features:
- Implements value object interfaces like
IEquatable
,IComparable
, etc. - Leverages regex for validation.
- Provides implicit conversions to/from string.
- Includes constants for common scenarios.
- Generates a mailto: URI.
EmailAddress
can be used anywhere an email address value is needed:
var email = EmailAddress.From("[email protected]");
if (!email.IsEmpty) {
// use email
}
PhoneNumber
- A phone number value type
This file contains the implementation of the PhoneNumber
value object for representing phone numbers.
The PhoneNumber
struct encapsulates parsing, validation, and formatting of phone numbers in a reusable way.
Key features:
- Implements
IRegexValueObject
for parsing and validation. - Leverages
libphonenumber
for parsing into components. - Provides implicit conversions to/from string.
- Generates a tel: URI from the number.
- Includes constants like
Empty
,ExampleValue
, etc.
PhoneNumber
can be used anywhere a parsed, validated phone number value is needed:
var number = PhoneNumber.From("+12025551234");
Console.WriteLine(number.IsEmpty); // true
Console.WriteLine(number.ToString()); // +12025551234
ObjectId
- A 24-hex-digit (96-bit) string
This directory contains the implementation of the ObjectId
value object.
The ObjectId
struct represents an ObjectId value commonly used in MongoDB. It aims to encapsulate ObjectId parsing, validation, and formatting logic in a reusable way.
Key features:
- Implements value object interfaces like
IEquatable
,IComparable
, etc. - Leverages regex for validation.
- Provides static factory methods like
Parse
andTryParse
. - Generates a
URN
identifierURI
. - Includes constants for common scenarios.
ObjectId
can be used anywhere a MongoDB ObjectId value is needed:
var id = ObjectId.TryParse("61f7c3692093f4d09f000123", out var oid) ? oid : ObjectId.Empty;
if (id.IsEmpty) {
// use id
}
These are a collection of X
Resource Y
s.