func (factory *identifierFactory) CreateIdentifier(name string, visibility Visibility) string {
	cacheKey := idCacheKey{name, visibility}
	factory.rwLock.RLock()
	cached, ok := factory.idCache[cacheKey]
	factory.rwLock.RUnlock()
	if ok {
		return cached
	}
	result := factory.createIdentifierUncached(name, visibility)
	factory.rwLock.Lock()
	factory.idCache[cacheKey] = result
	factory.rwLock.Unlock()
	return result
}
CreateIdentifier returns a valid Go public identifier
package astmodel
import (
	"regexp"
	"strings"
	"sync"
	"unicode"
)
var filterRegex = regexp.MustCompile(`[\W_]`)
type Visibility string
const (
	Exported    = Visibility("exported")
	NotExported = Visibility("notexported")
)
type IdentifierFactory interface {
	CreateIdentifier(name string, visibility Visibility) string
	CreatePropertyName(propertyName string, visibility Visibility) PropertyName
	CreateGroupName(name string) string
	CreateEnumIdentifier(namehint string) string
}
type identifierFactory struct {
	renames       map[string]string
	reservedWords map[string]string
	idCache idCache
	rwLock  sync.RWMutex
}
type idCacheKey struct {
	name       string
	visibility Visibility
}
type idCache map[idCacheKey]string
var _ IdentifierFactory = (*identifierFactory)(nil)
func NewIdentifierFactory() IdentifierFactory {
	return &identifierFactory{
		renames:       createRenames(),
		reservedWords: createReservedWords(),
		idCache:       make(idCache),
	}
}