@@ -35,26 +35,26 @@ func (v *View) Definition() Node {
3535
3636// Views are scoped by the databases in which they were defined, so a key in
3737// the view registry is a pair of names: database and view.
38- type viewKey struct {
38+ type ViewKey struct {
3939 dbName , viewName string
4040}
4141
42- // newViewKey creates a viewKey ensuring both names are lowercase.
43- func newViewKey (databaseName , viewName string ) viewKey {
44- return viewKey {strings .ToLower (databaseName ), strings .ToLower (viewName )}
42+ // NewViewKey creates a ViewKey ensuring both names are lowercase.
43+ func NewViewKey (databaseName , viewName string ) ViewKey {
44+ return ViewKey {strings .ToLower (databaseName ), strings .ToLower (viewName )}
4545}
4646
47- // ViewRegistry is a map of viewKey to View whose access is protected by a
47+ // ViewRegistry is a map of ViewKey to View whose access is protected by a
4848// RWMutex.
4949type ViewRegistry struct {
5050 mutex sync.RWMutex
51- views map [viewKey ]View
51+ views map [ViewKey ]View
5252}
5353
5454// NewViewRegistry creates an empty ViewRegistry.
5555func NewViewRegistry () * ViewRegistry {
5656 return & ViewRegistry {
57- views : make (map [viewKey ]View ),
57+ views : make (map [ViewKey ]View ),
5858 }
5959}
6060
@@ -64,7 +64,7 @@ func (r *ViewRegistry) Register(database string, view View) error {
6464 r .mutex .Lock ()
6565 defer r .mutex .Unlock ()
6666
67- key := newViewKey (database , view .Name ())
67+ key := NewViewKey (database , view .Name ())
6868
6969 if _ , ok := r .views [key ]; ok {
7070 return ErrExistingView .New (database , view .Name ())
@@ -80,7 +80,7 @@ func (r *ViewRegistry) Delete(databaseName, viewName string) error {
8080 r .mutex .Lock ()
8181 defer r .mutex .Unlock ()
8282
83- key := newViewKey (databaseName , viewName )
83+ key := NewViewKey (databaseName , viewName )
8484
8585 if _ , ok := r .views [key ]; ! ok {
8686 return ErrNonExistingView .New (databaseName , viewName )
@@ -96,7 +96,7 @@ func (r *ViewRegistry) View(databaseName, viewName string) (*View, error) {
9696 r .mutex .RLock ()
9797 defer r .mutex .RUnlock ()
9898
99- key := newViewKey (databaseName , viewName )
99+ key := NewViewKey (databaseName , viewName )
100100
101101 if view , ok := r .views [key ]; ok {
102102 return & view , nil
@@ -106,7 +106,7 @@ func (r *ViewRegistry) View(databaseName, viewName string) (*View, error) {
106106}
107107
108108// AllViews returns the map of all views in the registry.
109- func (r * ViewRegistry ) AllViews () map [viewKey ]View {
109+ func (r * ViewRegistry ) AllViews () map [ViewKey ]View {
110110 r .mutex .RLock ()
111111 defer r .mutex .RUnlock ()
112112
0 commit comments