2020-07-30 01:08:04 +00:00
|
|
|
package storage
|
|
|
|
|
|
|
|
import (
|
2021-11-02 21:00:54 +00:00
|
|
|
"errors"
|
|
|
|
|
|
|
|
"google.golang.org/protobuf/types/known/anypb"
|
2020-07-30 01:08:04 +00:00
|
|
|
)
|
|
|
|
|
2021-11-02 21:00:54 +00:00
|
|
|
func GetReadSource(any *anypb.Any) (*ReadSource, error) {
|
|
|
|
if any == nil {
|
|
|
|
return nil, errors.New("reque")
|
|
|
|
}
|
2021-09-09 18:37:11 +00:00
|
|
|
var source ReadSource
|
2021-11-02 21:00:54 +00:00
|
|
|
if err := any.UnmarshalTo(&source); err != nil {
|
2021-09-09 18:37:11 +00:00
|
|
|
return nil, err
|
2020-07-30 01:08:04 +00:00
|
|
|
}
|
2021-09-09 18:37:11 +00:00
|
|
|
return &source, nil
|
2020-07-30 01:08:04 +00:00
|
|
|
}
|