mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-15 12:27:59 +00:00
30 lines
489 B
Go
30 lines
489 B
Go
|
package cache
|
||
|
|
||
|
import (
|
||
|
"errors"
|
||
|
"fmt"
|
||
|
)
|
||
|
|
||
|
type IndexUnknownError[I comparable] struct {
|
||
|
index I
|
||
|
}
|
||
|
|
||
|
func NewIndexUnknownErr[I comparable](index I) error {
|
||
|
return IndexUnknownError[I]{index}
|
||
|
}
|
||
|
|
||
|
func (i IndexUnknownError[I]) Error() string {
|
||
|
return fmt.Sprintf("index %v unknown", i.index)
|
||
|
}
|
||
|
|
||
|
func (a IndexUnknownError[I]) Is(err error) bool {
|
||
|
if b, ok := err.(IndexUnknownError[I]); ok {
|
||
|
return a.index == b.index
|
||
|
}
|
||
|
return false
|
||
|
}
|
||
|
|
||
|
var (
|
||
|
ErrCacheMiss = errors.New("cache miss")
|
||
|
)
|