Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
interface-go-dms3-core
Commits
ca13e9b2
Commit
ca13e9b2
authored
Feb 02, 2018
by
Łukasz Magiera
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
coreapi: Pin option for Object.Put
License: MIT Signed-off-by:
Łukasz Magiera
<
magik6k@gmail.com
>
parent
ebc2b357
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
0 deletions
+11
-0
options/object.go
options/object.go
+11
-0
No files found.
options/object.go
View file @
ca13e9b2
...
...
@@ -7,6 +7,7 @@ type ObjectNewSettings struct {
type
ObjectPutSettings
struct
{
InputEnc
string
DataType
string
Pin
bool
}
type
ObjectAddLinkSettings
struct
{
...
...
@@ -35,6 +36,7 @@ func ObjectPutOptions(opts ...ObjectPutOption) (*ObjectPutSettings, error) {
options
:=
&
ObjectPutSettings
{
InputEnc
:
"json"
,
DataType
:
"text"
,
Pin
:
false
,
}
for
_
,
opt
:=
range
opts
{
...
...
@@ -103,6 +105,15 @@ func (objectOpts) DataType(t string) ObjectPutOption {
}
}
// WithPin is an option for Object.Put which specifies whether to pin the added
// objects, default is false
func
(
objectOpts
)
WithPin
(
pin
bool
)
ObjectPutOption
{
return
func
(
settings
*
ObjectPutSettings
)
error
{
settings
.
Pin
=
pin
return
nil
}
}
// Create is an option for Object.AddLink which specifies whether create required
// directories for the child
func
(
objectOpts
)
Create
(
create
bool
)
ObjectAddLinkOption
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment