2024-08-15 15:12:42 +00:00
|
|
|
// 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)
|
2024-09-19 08:03:23 +00:00
|
|
|
NewFromParsedURI(uri *url.URL) (result Product, err error)
|
2024-10-16 17:26:42 +00:00
|
|
|
NewFromType(typename string) (result Product, err error)
|
2024-08-15 15:12:42 +00:00
|
|
|
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
|
|
|
|
}
|