File: base_types.go

package info (click to toggle)
golang-github-linode-linodego 1.55.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 13,112 kB
  • sloc: makefile: 96; sh: 52; python: 24
file content (29 lines) | stat: -rw-r--r-- 953 bytes parent folder | download | duplicates (2)
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
// This package contains various type-related base classes intended
// to be used in composition across type structures in this project.

package linodego

// baseType is a base struct containing the core fields of a resource type
// returned from the Linode API.
type baseType[PriceType any, RegionPriceType any] struct {
	ID           string            `json:"id"`
	Label        string            `json:"label"`
	Price        PriceType         `json:"price"`
	RegionPrices []RegionPriceType `json:"region_prices"`
	Transfer     int               `json:"transfer"`
}

// baseTypePrice is a base struct containing the core fields of a resource type's
// base price.
type baseTypePrice struct {
	Hourly  float64 `json:"hourly"`
	Monthly float64 `json:"monthly"`
}

// baseTypeRegionPrice is a base struct containing the core fields of a resource type's
// region-specific price.
type baseTypeRegionPrice struct {
	baseTypePrice

	ID string `json:"id"`
}