-
Notifications
You must be signed in to change notification settings - Fork 5
/
portfolio_aip.go
54 lines (46 loc) · 1.09 KB
/
portfolio_aip.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// Code generated by protoc-gen-go-aip. DO NOT EDIT.
//
// versions:
// protoc-gen-go-aip development
// protoc (unknown)
// source: coinbase/staking/rewards/v1/portfolio.proto
package v1
import (
fmt "fmt"
resourcename "go.einride.tech/aip/resourcename"
strings "strings"
)
type PortfolioResourceName struct {
Portfolio string
}
func (n PortfolioResourceName) Validate() error {
if n.Portfolio == "" {
return fmt.Errorf("portfolio: empty")
}
if strings.IndexByte(n.Portfolio, '/') != -1 {
return fmt.Errorf("portfolio: contains illegal character '/'")
}
return nil
}
func (n PortfolioResourceName) ContainsWildcard() bool {
return false || n.Portfolio == "-"
}
func (n PortfolioResourceName) String() string {
return resourcename.Sprint(
"portfolios/{portfolio}",
n.Portfolio,
)
}
func (n PortfolioResourceName) MarshalString() (string, error) {
if err := n.Validate(); err != nil {
return "", err
}
return n.String(), nil
}
func (n *PortfolioResourceName) UnmarshalString(name string) error {
return resourcename.Sscan(
name,
"portfolios/{portfolio}",
&n.Portfolio,
)
}