mirror of
https://github.com/anyproto/anytype-heart.git
synced 2025-06-09 09:35:00 +09:00
Merge branch 'master' of ssh://github.com/anytypeio/go-anytype-middleware into updated-getstarted
# Conflicts: # util/pbtypes/pbtypes.go
This commit is contained in:
commit
2a60a48a82
14 changed files with 121 additions and 60 deletions
|
@ -58,7 +58,7 @@ type BuiltinObjects interface {
|
|||
}
|
||||
|
||||
type objectCreator interface {
|
||||
CreateSmartBlockFromState(ctx context.Context, sbType coresb.SmartBlockType, details *types.Struct, relationIds []string, createState *state.State) (id string, newDetails *types.Struct, err error)
|
||||
CreateSmartBlockFromState(ctx context.Context, sbType coresb.SmartBlockType, details *types.Struct, createState *state.State) (id string, newDetails *types.Struct, err error)
|
||||
}
|
||||
|
||||
type builtinObjects struct {
|
||||
|
@ -257,7 +257,7 @@ func (b *builtinObjects) createObject(ctx context.Context, rd io.ReadCloser) (er
|
|||
return err
|
||||
}
|
||||
|
||||
_, _, err = b.objectCreator.CreateSmartBlockFromState(ctx, sbt, nil, nil, st)
|
||||
_, _, err = b.objectCreator.CreateSmartBlockFromState(ctx, sbt, nil, st)
|
||||
if isFavorite {
|
||||
err = b.service.SetPageIsFavorite(pb.RpcObjectSetIsFavoriteRequest{ContextId: newId, IsFavorite: true})
|
||||
if err != nil {
|
||||
|
|
|
@ -428,3 +428,15 @@ func StructCompareIgnoreKeys(st1 *types.Struct, st2 *types.Struct, ignoreKeys []
|
|||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// ValueListWrapper wraps single value into the list. If value is already a list, it is returned as is.
|
||||
// Null and struct values are not supported
|
||||
func ValueListWrapper(value *types.Value) (*types.ListValue, error) {
|
||||
switch v := value.Kind.(type) {
|
||||
case *types.Value_ListValue:
|
||||
return v.ListValue, nil
|
||||
case *types.Value_StringValue, *types.Value_NumberValue, *types.Value_BoolValue:
|
||||
return &types.ListValue{Values: []*types.Value{value}}, nil
|
||||
}
|
||||
return nil, fmt.Errorf("not supported type")
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue