Schemes returns the list of transport schemes used by all the API servers. The possible values for the elements of the returned slice are "http", "https", "grpc" and "grpcs".
()
| 129 | // The possible values for the elements of the returned slice are "http", |
| 130 | // "https", "grpc" and "grpcs". |
| 131 | func (a *APIExpr) Schemes() []string { |
| 132 | schemes := make(map[string]struct{}) |
| 133 | for _, s := range a.Servers { |
| 134 | for _, sch := range s.Schemes() { |
| 135 | schemes[sch] = struct{}{} |
| 136 | } |
| 137 | } |
| 138 | ss := make([]string, len(schemes)) |
| 139 | i := 0 |
| 140 | for s := range schemes { |
| 141 | ss[i] = s |
| 142 | i++ |
| 143 | } |
| 144 | sort.Strings(ss) |
| 145 | return ss |
| 146 | } |
| 147 | |
| 148 | // DefaultServer returns a server expression that describes a server which |
| 149 | // exposes all the services in the design and listens on localhost port 80 for |
no outgoing calls