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
2e3f9758
Commit
2e3f9758
authored
Mar 25, 2018
by
Łukasz Magiera
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
coreapi: use defined functions for pin type option
License: MIT Signed-off-by:
Łukasz Magiera
<
magik6k@gmail.com
>
parent
38ccf055
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
2 deletions
+30
-2
options/pin.go
options/pin.go
+30
-2
No files found.
options/pin.go
View file @
2e3f9758
...
...
@@ -61,10 +61,38 @@ func PinUpdateOptions(opts ...PinUpdateOption) (*PinUpdateSettings, error) {
return
options
,
nil
}
type
pinOpts
struct
{}
type
pinType
struct
{}
type
pinOpts
struct
{
Type
pinType
}
var
Pin
pinOpts
// All is an option for Pin.Ls which will make it return all pins. It is
// the default
func
(
_
pinType
)
All
()
PinLsOption
{
return
Pin
.
pinType
(
"all"
)
}
// Recursive is an option for Pin.Ls which will make it only return recursive
// pins
func
(
_
pinType
)
Recursive
()
PinLsOption
{
return
Pin
.
pinType
(
"recursive"
)
}
// Direct is an option for Pin.Ls which will make it only return direct (non
// recursive) pins
func
(
_
pinType
)
Direct
()
PinLsOption
{
return
Pin
.
pinType
(
"direct"
)
}
// Indirect is an option for Pin.Ls which will make it only return indirect pins
// (objects referenced by other recursively pinned objects)
func
(
_
pinType
)
Indirect
()
PinLsOption
{
return
Pin
.
pinType
(
"indirect"
)
}
// Recursive is an option for Pin.Add which specifies whether to pin an entire
// object tree or just one object. Default: true
func
(
_
pinOpts
)
Recursive
(
recucsive
bool
)
PinAddOption
{
...
...
@@ -83,7 +111,7 @@ func (_ pinOpts) Recursive(recucsive bool) PinAddOption {
// * "indirect" - indirectly pinned objects (referenced by recursively pinned
// objects)
// * "all" - all pinned objects (default)
func
(
_
pinOpts
)
Type
(
t
string
)
PinLsOption
{
func
(
_
pinOpts
)
pin
Type
(
t
string
)
PinLsOption
{
return
func
(
settings
*
PinLsSettings
)
error
{
settings
.
Type
=
t
return
nil
...
...
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