26 lines
590 B
Go
26 lines
590 B
Go
// Copyright 2024 Matthew Rich <matthewrich.conf@gmail.com>. All rights reserved.
|
|
|
|
package data
|
|
|
|
import (
|
|
"net/url"
|
|
)
|
|
|
|
type Factory[Product comparable] func(*url.URL) Product
|
|
|
|
type TypesRegistry[Product comparable] interface {
|
|
New(uri string) (result Product, err error)
|
|
NewFromParsedURI(uri *url.URL) (result Product, err error)
|
|
NewFromType(typename string) (result Product, err error)
|
|
Has(typename string) bool
|
|
//Get(string) Factory[Product]
|
|
}
|
|
|
|
type TypeName string //`json:"type"`
|
|
|
|
func (t TypeName) String() string { return string(t) }
|
|
|
|
type Typer interface {
|
|
Type() TypeName
|
|
}
|