From 0c461517006a75c771ff3be30712e886a93013cd Mon Sep 17 00:00:00 2001 From: Blake Mizerany Date: Thu, 4 Apr 2024 16:16:39 -0700 Subject: [PATCH] x/model: add docs to Name --- x/model/name.go | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/x/model/name.go b/x/model/name.go index 23f99f875..39e3b47f4 100644 --- a/x/model/name.go +++ b/x/model/name.go @@ -35,9 +35,23 @@ var kindNames = map[NamePart]string{ // Name is an opaque reference to a model. // -// It is comparable and can be used as a map key. +// It is not comparable. To use as a map key, use [MapHash]. // -// Users or Name must check Valid before using it. +// Clients should use the [ParseName] function to create a Name from a string. +// +// The parts of a Name are: +// +// - Host: the domain of the model (optional) +// - Namespace: the namespace of the model (optional) +// - Model: the name of the model (required) +// - Tag: the tag of the model (optional) +// - Build: the build of the model; usually the quantization or "file type" (optional) +// +// A call to [Name.Valid] will return true if the model has a valid non-empty model +// part. +// +// A call to [Name.Complete] will return true if the model has a valid model part +// and all of its other parts are also non-empty and valid. type Name struct { _ structs.Incomparable