Skip to content

Add a AnyID() string helper on the type id to convert any arbitrary id type into the common AnyID #13

Open
@mscno

Description

@mscno

Implement a helper method AnyID() on the TypeID type (or as a generic helper) that converts any arbitrary custom ID type into a standard type safe AnyID (i.e. the common AnyID representation). This will allow developers to easily get a typed value with guaranteed valid prefix (to differentiate from string type) from their custom TypeIDs without breaking compile-time safety elsewhere.

Essentially just a helper function to do the following

document.ID.AnyID() -> typeid.AnyID

instead of

typeid.Must(typeid.Parse[typeid.AnyID](document.ID.String()))  -> typeid.AnyID

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions