Skip to content

Commit

Permalink
feat(types): improve datasource write api (#3763)
Browse files Browse the repository at this point in the history
  • Loading branch information
NDStrahilevitz committed Dec 19, 2023
1 parent 82f04f2 commit aa8b62c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions types/detect/detect.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,16 +98,16 @@ var ErrFailedToUnmarshal = errors.New("given value could not be unmarshaled")

type WriteableDataSource interface {
DataSource
// Write a value to a key in the data source. The value can not strictly match the schema defined
// Write values to keys in the data source. The values may not strictly match the schema defined
// in the data source, however the implementation must be able to unmarshal it successfully to some form
// where it can be eventually represented by the schema.
//
// The following errors should be returned for the appropriate cases:
//
// - ErrKeyNotSupported - When the key used does not match to a support key
// - ErrFailedToUnmarshal - When the value given could not be unmarshalled to an expected type
// - ErrKeyNotSupported - When a given key does not match to supported key type
// - ErrFailedToUnmarshal - When a value given could not be unmarshalled to an expected type
// - Otherwise errors may vary.
Write(key interface{}, value interface{}) error
Write(data map[interface{}]interface{}) error
// The types of values the data source supports writing.
Values() []string
}

0 comments on commit aa8b62c

Please sign in to comment.