Skip to content

Commit

Permalink
export some query interfaces (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
DanG100 authored Sep 1, 2022
1 parent db13f65 commit d93fc4e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
30 changes: 15 additions & 15 deletions ygnmi/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,17 +112,17 @@ type LeafSingletonQuery[T any] struct {
leafBaseQuery[T]
}

// isSingleton prevents this struct from being used where a wildcard path is expected.
func (lq *LeafSingletonQuery[T]) isSingleton() {}
// IsSingleton prevents this struct from being used where a wildcard path is expected.
func (lq *LeafSingletonQuery[T]) IsSingleton() {}

// LeafWildcardQuery is implementation of SingletonQuery interface for leaf nodes.
// Note: Do not use this type directly, instead use the generated Path API.
type LeafWildcardQuery[T any] struct {
leafBaseQuery[T]
}

// isWildcard prevents this struct from being used where a non wildcard path is expected.
func (lq *LeafWildcardQuery[T]) isWildcard() {}
// IsWildcard prevents this struct from being used where a non wildcard path is expected.
func (lq *LeafWildcardQuery[T]) IsWildcard() {}

type leafBaseQuery[T any] struct {
// parent is name of the YANG directory which contains this leaf.
Expand Down Expand Up @@ -193,8 +193,8 @@ type NonLeafSingletonQuery[T ygot.ValidatedGoStruct] struct {
nonLeafBaseQuery[T]
}

// isSingleton prevents this struct from being used where a wildcard path is expected.
func (lq *NonLeafSingletonQuery[T]) isSingleton() {}
// IsSingleton prevents this struct from being used where a wildcard path is expected.
func (lq *NonLeafSingletonQuery[T]) IsSingleton() {}

// NonLeafWildcardQuery is implementation of SingletonQuery interface for non-leaf nodes.
// Note: Do not use this type directly, instead use the generated Path API.
Expand All @@ -203,7 +203,7 @@ type NonLeafWildcardQuery[T ygot.ValidatedGoStruct] struct {
}

// isNonWildcard prevents this struct from being used where a non-wildcard path is expected.
func (lq *NonLeafWildcardQuery[T]) isWildcard() {}
func (lq *NonLeafWildcardQuery[T]) IsWildcard() {}

type nonLeafBaseQuery[T ygot.ValidatedGoStruct] struct {
dir string
Expand Down Expand Up @@ -276,20 +276,20 @@ type LeafConfigQuery[T any] struct {
leafBaseQuery[T]
}

// isConfig restricts this struct to be used only where a config path is expected.
func (lq *LeafConfigQuery[T]) isConfig() {}
// IsConfig restricts this struct to be used only where a config path is expected.
func (lq *LeafConfigQuery[T]) IsConfig() {}

// isSingleton restricts this struct to be used only where a singleton path is expected.
func (lq *LeafConfigQuery[T]) isSingleton() {}
// IsSingleton restricts this struct to be used only where a singleton path is expected.
func (lq *LeafConfigQuery[T]) IsSingleton() {}

// NonLeafConfigQuery is implementation of ConfigQuery interface for non-leaf nodes.
// Note: Do not use this type directly, instead use the generated Path API.
type NonLeafConfigQuery[T ygot.ValidatedGoStruct] struct {
nonLeafBaseQuery[T]
}

// isConfig restricts this struct to be used only where a config path is expected.
func (nlq *NonLeafConfigQuery[T]) isConfig() {}
// IsConfig restricts this struct to be used only where a config path is expected.
func (nlq *NonLeafConfigQuery[T]) IsConfig() {}

// isSingleton restricts this struct to be used only where a singleton path is expected.
func (nlq *NonLeafConfigQuery[T]) isSingleton() {}
// IsSingleton restricts this struct to be used only where a singleton path is expected.
func (nlq *NonLeafConfigQuery[T]) IsSingleton() {}
16 changes: 8 additions & 8 deletions ygnmi/ygnmi.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,24 +60,24 @@ type AnyQuery[T any] interface {
// SingletonQuery is a non-wildcard gNMI query.
type SingletonQuery[T any] interface {
AnyQuery[T]
// isSingleton restricts this interface to be used only where a singleton path is expected.
isSingleton()
// IsSingleton restricts this interface to be used only where a singleton path is expected.
IsSingleton()
}

// WildcardQuery is a wildcard gNMI query.
type WildcardQuery[T any] interface {
AnyQuery[T]
// isWildcard restricts this interface to be used only where a wildcard path is expected.
isWildcard()
// IsWildcard restricts this interface to be used only where a wildcard path is expected.
IsWildcard()
}

// ConfigQuery is a non-wildcard config gNMI query.
type ConfigQuery[T any] interface {
AnyQuery[T]
// isConfig() allows this interface to be use in config funcs.
isConfig()
// isSingleton restricts this interface to be used only where a singleton path is expected.
isSingleton()
// IsConfig() allows this interface to be use in config funcs.
IsConfig()
// IsSingleton restricts this interface to be used only where a singleton path is expected.
IsSingleton()
}

// Value contains a value received from a gNMI request and its metadata.
Expand Down

0 comments on commit d93fc4e

Please sign in to comment.