model

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 12, 2018 License: Apache-2.0 Imports: 10 Imported by: 15

Documentation

Index

Constants

View Source
const (
	UserRoleAdmin = "admin"
	UserRoleUser  = "user"
)
View Source
const (
	DefaultTillerNamespace = "kube-system"
)

Variables

This section is empty.

Functions

func CheckImmutableFields added in v0.11.1

func CheckImmutableFields(m Model) error

CheckImmutableFields returns an error if any fields with the sg tag "immutable" have values (are not zero).

func CloudAccountSchema added in v1.0.0

func CloudAccountSchema() map[string]interface{}

CloudAccountSchema returns a default model and schema. For use with api.

func RootFieldJSONNames added in v0.10.1

func RootFieldJSONNames(m Model) (fields []string)

RootFieldJSONNames takes a model and returns the json name tag for every top-level field.

func ZeroPrivateFields

func ZeroPrivateFields(r Model)

ZeroPrivateFields takes a Model with pointer, and zeroes any fields with the tag sg:"private".

func ZeroReadonlyFields

func ZeroReadonlyFields(r Model)

ZeroReadonlyFields takes a Model with pointer, and zeroes any fields with the tag sg:"readonly".

Types

type AWSKubeConfig

type AWSKubeConfig struct {
	Region           string `json:"region" validate:"nonzero,regexp=^[a-z]{2}-[a-z]+-[0-9]$"`
	AvailabilityZone string `json:"availability_zone"`
	VPCIPRange       string `json:"vpc_ip_range" validate:"nonzero" sg:"default=172.20.0.0/16"`
	// TODO this should be a slice of objects instead of maps, since we have a rigid key structure
	PublicSubnetIPRange []map[string]string `json:"public_subnet_ip_range"`
	MultiAZ             bool                `json:"multi_az"`
	BucketName          string              `json:"bucket_name,omitempty" sg:"readonly"`
	NodeVolumeSize      int                 `json:"node_volume_size" sg:"default=100"`
	MasterVolumeSize    int                 `json:"master_volume_size" sg:"default=100"`

	MasterRoleName                string            `json:"master_role"`
	NodeRoleName                  string            `json:"node_role"`
	Tags                          map[string]string `json:"tags"`
	LastSelectedAZ                string            `json:"last_selected_az" sg:"readonly"` // if using multiAZ this is the last az the node build used.
	PrivateKey                    string            `json:"private_key,omitempty" sg:"readonly"`
	VPCID                         string            `json:"vpc_id"`
	VPCMANAGED                    bool              `json:"vpc_managed"`
	InternetGatewayID             string            `json:"internet_gateway_id"`
	RouteTableID                  string            `json:"route_table_id"`
	RouteTableSubnetAssociationID []string          `json:"route_table_subnet_association_id" sg:"readonly"`
	PrivateNetwork                bool              `json:"private_network"`
	MasterSecurityGroupID         string            `json:"elb_security_group_id" sg:"readonly"`
	NodeSecurityGroupID           string            `json:"node_security_group_id" sg:"readonly"`
	ElasticFileSystemID           string            `json:"elastic_filesystem_id"`
	ElasticFileSystemTargets      []string          `json:"elastic_filesystem_targets" sg:"readonly"`
	BuildElasticFileSystem        bool              `json:"build_elastic_filesystem"`
}

AWSKubeConfig holds aws specific information about AWS based KUbernetes clusters.

type ActionStatus

type ActionStatus struct {
	Description    string `json:"description"`
	MaxRetries     int    `json:"max_retries"`
	Retries        int    `json:"retries"`
	Error          string `json:"error,omitempty"`
	Cancelled      bool   `json:"cancelled,omitempty"`
	TotalSteps     int    `json:"total_steps,omitempty"`
	StepsCompleted int    `json:"steps_completed,omitempty"`
}

ActionStatus holds all the information pertaining to any running or failed Async Actions, and is rendered on the model on display (not persisted).

type BaseList added in v0.10.1

type BaseList struct {
	// Filters input looks like this:
	// {
	// 	"name": [
	// 		"this", "that"
	// 	],
	// 	"other_field": [
	// 		"thingy"
	// 	]
	// }
	// The values of each key are joined as OR queries.
	// Multiple keys are joined as AND queries.
	// The above translates to "(name=this OR name=that) AND (other_fied=thingy)".
	Filters map[string][]string `json:"filters"`

	// Pagination
	Offset int64 `json:"offset"`
	Limit  int64 `json:"limit"`
	Total  int64 `json:"total"`
}

func (*BaseList) QueryValues added in v0.10.1

func (l *BaseList) QueryValues() map[string][]string

func (*BaseList) Set added in v1.0.0

func (l *BaseList) Set(total, limit, offset int64)

type BaseModel

type BaseModel struct {
	ID        *int64        `gorm:"primary_key" json:"id,omitempty" sg:"readonly"`
	UUID      string        `json:"uuid" gorm:"not null" sg:"readonly"`
	CreatedAt time.Time     `json:"created_at" sg:"readonly"`
	UpdatedAt time.Time     `json:"updated_at" sg:"readonly"`
	Status    *ActionStatus `gorm:"-" json:"status,omitempty"`

	PassiveStatus     string `gorm:"-" json:"passive_status,omitempty"`
	PassiveStatusOkay bool   `gorm:"-" json:"passive_status_okay,omitempty"`
}

BaseModel implements the Model interface, and is composed into all persisted Supergiant resources.

func (*BaseModel) GetID

func (m *BaseModel) GetID() interface{}

GetID returns the model ID.

func (*BaseModel) GetUUID

func (m *BaseModel) GetUUID() string

GetUUID returns the model UUID.

func (*BaseModel) SetActionStatus

func (m *BaseModel) SetActionStatus(status *ActionStatus)

SetActionStatus takes an *ActionStatus and sets it on the model.

func (*BaseModel) SetPassiveStatus added in v0.11.0

func (m *BaseModel) SetPassiveStatus()

SetPassiveStatus implements the Model interface, but does nothing. It can be used by models to set render the PassiveStatus and PassiveStatusOkay fields.

func (*BaseModel) SetUUID

func (m *BaseModel) SetUUID() error

SetUUID sets the model UUID.

type BelongsToField

type BelongsToField struct {
	Field reflect.StructField
	Value reflect.Value
}

BelongsToField holds the reflect StructField (type) and Value of a model field representing the parent object in a belongs_to relation.

type CloudAccount

type CloudAccount struct {
	BaseModel

	// has_many Kubes
	Kubes []*Kube `json:"kubes,omitempty" gorm:"ForeignKey:CloudAccountName;AssociationForeignKey:Name"`

	Name string `json:"name" validate:"nonzero" gorm:"not null;unique_index" sg:"immutable"`

	Provider string `json:"provider" validate:"regexp=^(aws|digitalocean|openstack|gce|packet)$" gorm:"not null" sg:"immutable"`

	// NOTE this is loose map to allow for multiple clouds (eventually)
	Credentials     map[string]string `json:"credentials,omitempty" validate:"nonzero" gorm:"-" sg:"store_as_json_in=CredentialsJSON,private,immutable"`
	CredentialsJSON []byte            `json:"-" gorm:"not null"`
}

type CloudAccountList added in v0.10.1

type CloudAccountList struct {
	BaseList
	Items []*CloudAccount `json:"items"`
}

type DOKubeConfig added in v0.10.0

type DOKubeConfig struct {
	Region            string   `json:"region" validate:"nonzero"`
	SSHKeyFingerprint []string `json:"ssh_key_fingerprint" validate:"nonzero"`
}

DOKubeConfig holds do specific information about DO based KUbernetes clusters.

type Error

type Error struct {
	Status  int    `json:"status"`
	Message string `json:"message"`
}

func (*Error) Error

func (e *Error) Error() string

type ErrorChangedImmutableField added in v0.11.1

type ErrorChangedImmutableField struct {
	// contains filtered or unexported fields
}

ErrorChangedImmutableField is an error for when a model has a value defined in a field with the sg tag "immutable" (used for updates).

func (*ErrorChangedImmutableField) Error added in v0.11.1

func (err *ErrorChangedImmutableField) Error() string

type GCEKubeConfig added in v0.13.5

type GCEKubeConfig struct {
	Zone                string `json:"zone" validate:"nonzero"`
	MasterInstanceGroup string `json:"master_instance_group" sg:"readonly"`
	MinionInstanceGroup string `json:"minion_instance_group" sg:"readonly"`
}

GCEKubeConfig holds do specific information about DO based KUbernetes clusters.

type HelmChart added in v0.14.0

type HelmChart struct {
	BaseModel

	// belongs_to Repo
	Repo     *HelmRepo `json:"repo,omitempty" gorm:"ForeignKey:RepoName;AssociationForeignKey:Name"`
	RepoName string    `json:"repo_name" validate:"nonzero" gorm:"not null;index" sg:"immutable"`

	Name        string `json:"name" validate:"nonzero" gorm:"not null;index" sg:"immutable"`
	Version     string `json:"version" validate:"nonzero"`
	Description string `json:"description" validate:"nonzero"`

	DefaultConfig     map[string]interface{} `json:"default_config" gorm:"-" sg:"store_as_json_in=DefaultConfigJSON,immutable"`
	DefaultConfigJSON []byte                 `json:"-"`
}

type HelmChartList added in v0.14.0

type HelmChartList struct {
	BaseList
	Items []*HelmChart `json:"items"`
}

type HelmRelease added in v0.14.0

type HelmRelease struct {
	BaseModel

	// belongs_to Kube
	Kube     *Kube  `json:"kube,omitempty" gorm:"ForeignKey:KubeName;AssociationForeignKey:Name"`
	KubeName string `json:"kube_name" gorm:"not null;index" validate:"nonzero" sg:"immutable"`

	// NOTE this is just a "soft" belongs_to.
	// We don't do relation since there's no real need, and it complicates things.
	RepoName     string `json:"repo_name" gorm:"not null;index" sg:"immutable"`
	ChartName    string `json:"chart_name" gorm:"not null;index" validate:"nonzero" sg:"immutable"`
	ChartVersion string `json:"chart_version" validate:"nonzero" sg:"immutable"`

	Name      string `json:"name" validate:"regexp=^[\\w-\\.]*$" gorm:"index" sg:"immutable"`
	Namespace string `json:"namespace" validate:"regexp=^[\\w-\\.]*$" gorm:"index" sg:"immutable"`

	Revision string `json:"revision"`
	// TODO weird naming, but Status is already taken
	StatusValue  string `json:"status_value"`
	UpdatedValue string `json:"updated_value"`

	Config     map[string]interface{} `json:"config" gorm:"-" sg:"store_as_json_in=ConfigJSON,immutable"`
	ConfigJSON []byte                 `json:"-"`
}

func (*HelmRelease) SetPassiveStatus added in v0.14.0

func (m *HelmRelease) SetPassiveStatus()

type HelmReleaseList added in v0.14.0

type HelmReleaseList struct {
	BaseList
	Items []*HelmRelease `json:"items"`
}

type HelmRepo added in v0.14.0

type HelmRepo struct {
	BaseModel

	Name string `json:"name" validate:"nonzero" gorm:"not null;unique_index" sg:"immutable"`
	URL  string `json:"url" validate:"nonzero" gorm:"not null" sg:"immutable"`

	// has_many Charts
	Charts []*HelmChart `json:"charts,omitempty" gorm:"ForeignKey:RepoName;AssociationForeignKey:Name"`
}

type HelmRepoList added in v0.14.0

type HelmRepoList struct {
	BaseList
	Items []*HelmRepo `json:"items"`
}

type Kube

type Kube struct {
	BaseModel

	// belongs_to CloudAccount
	CloudAccount     *CloudAccount `json:"cloud_account,omitempty" gorm:"ForeignKey:CloudAccountName;AssociationForeignKey:Name"`
	CloudAccountName string        `json:"cloud_account_name" validate:"nonzero" gorm:"not null;index" sg:"immutable"`

	// has_many Nodes
	Nodes     []*Node `json:"nodes,omitempty" gorm:"ForeignKey:KubeName;AssociationForeignKey:Name" sg:"store_as_json_in=NodesJSON"`
	NodesJSON []byte  `json:"-"`
	// has_many LoadBalancers
	LoadBalancers     []*LoadBalancer `json:"load_balancers,omitempty" gorm:"ForeignKey:KubeName;AssociationForeignKey:Name" sg:"store_as_json_in=LoadBalancersJSON"`
	LoadBalancersJSON []byte          `json:"-"`
	// has_many KubeResources
	KubeResources     []*KubeResource `json:"kube_resources,omitempty" gorm:"ForeignKey:KubeName;AssociationForeignKey:Name" sg:"store_as_json_in=KubeResourcesJSON"`
	KubeResourcesJSON []byte          `json:"-"`
	// has_many HelmReleases
	HelmReleases     []*HelmRelease `json:"helm_releases,omitempty" gorm:"ForeignKey:KubeName;AssociationForeignKey:Name" sg:"store_as_json_in=HelmReleasesJSON"`
	HelmReleasesJSON []byte         `json:"-"`

	Name string `json:"name" validate:"nonzero,max=12,regexp=^[a-z]([-a-z0-9]*[a-z0-9])?$" gorm:"not null;unique_index" sg:"immutable"`
	// Kubernetes
	KubernetesVersion string `json:"kubernetes_version" validate:"nonzero" sg:"default=1.8.7"`
	SSHPubKey         string `json:"ssh_pub_key"`
	ETCDDiscoveryURL  string `json:"etcd_discovery_url" sg:"readonly"`

	// Tiller
	TillerNamespace string `json:"tiller_namespace"`

	// Kubernetes Master
	MasterNodeSize     string   `json:"master_node_size" validate:"nonzero" sg:"immutable"`
	MasterID           string   `json:"master_id" sg:"readonly"`
	MasterPrivateIP    string   `json:"master_private_ip" sg:"readonly"`
	KubeAPIPort        string   `json:"kube_api_port" sg:"readonly"`
	KubeMasterCount    int      `json:"kube_master_count"`
	MasterNodes        []string `json:"master_nodes" gorm:"-" sg:"store_as_json_in=MasterNodesJSON"`
	MasterNodesJSON    []byte   `json:"-"`
	MasterName         string   `json:"master_name" sg:"readonly"`
	CustomFiles        string   `json:"custom_files" sg:"readonly"`
	ProviderString     string   `json:"provider_string" sg:"readonly"`
	KubeProviderString string   `json:"Kube_provider_string" sg:"readonly"`
	ServiceString      string   `json:"service_string" sg:"readonly"`

	NodeSizes     []string `json:"node_sizes" gorm:"-" validate:"min=1" sg:"store_as_json_in=NodeSizesJSON"`
	NodeSizesJSON []byte   `json:"-" gorm:"not null"`

	Username string `json:"username" validate:"nonzero" sg:"immutable"`
	Password string `json:"password" validate:"nonzero" sg:"immutable"`

	RBACEnabled bool `json:"rbac_enabled"`

	HeapsterVersion          string `json:"heapster_version" validate:"nonzero" sg:"default=v1.4.0,immutable"`
	HeapsterMetricResolution string `json:"heapster_metric_resolution" validate:"regexp=^([0-9]+[smhd])+$" sg:"default=20s,immutable"`

	// NOTE due to how we marshal this as JSON, it's difficult to have this stored
	// as an interface, because unmarshalling causes us to lose the underlying
	// type. So, this is kindof like a whacky form of single-table inheritance.
	AWSConfig     *AWSKubeConfig `json:"aws_config,omitempty" gorm:"-" sg:"store_as_json_in=AWSConfigJSON,immutable"`
	AWSConfigJSON []byte         `json:"-"`

	DigitalOceanConfig     *DOKubeConfig `json:"digitalocean_config,omitempty" gorm:"-" sg:"store_as_json_in=DigitalOceanConfigJSON,immutable"`
	DigitalOceanConfigJSON []byte        `json:"-"`

	OpenStackConfig     *OSKubeConfig `json:"openstack_config,omitempty" gorm:"-" sg:"store_as_json_in=OpenStackConfigJSON,immutable"`
	OpenStackConfigJSON []byte        `json:"-"`

	GCEConfig     *GCEKubeConfig `json:"gce_config,omitempty" gorm:"-" sg:"store_as_json_in=GCEConfigJSON,immutable"`
	GCEConfigJSON []byte         `json:"-"`

	PACKConfig     *PACKKubeConfig `json:"packet_config,omitempty" gorm:"-" sg:"store_as_json_in=PACKConfigJSON,immutable"`
	PACKConfigJSON []byte          `json:"-"`

	MasterPublicIP string `json:"master_public_ip" sg:"readonly"`

	Ready bool `json:"ready" sg:"readonly" gorm:"index"`
	// This is used to store unstructured data such as metrics from Heapster.
	ExtraData     map[string]interface{} `json:"extra_data" gorm:"-" sg:"store_as_json_in=ExtraDataJSON,readonly"`
	ExtraDataJSON []byte                 `json:"-"`
}

Kube objects contains global info about kubernetes ckusters.

type KubeList added in v0.10.1

type KubeList struct {
	BaseList
	Items []*Kube `json:"items"`
}

type KubeResource added in v0.11.0

type KubeResource struct {
	BaseModel

	// belongs_to Kube
	Kube     *Kube  `json:"kube,omitempty" gorm:"ForeignKey:KubeName;AssociationForeignKey:Name"`
	KubeName string `json:"kube_name" validate:"nonzero" gorm:"not null;unique_index:kube_namespace_kind_name"`

	// Kind corresponds directly to the Kind of Kubernetes resource (e.g. Pod, Service, etc.)
	Kind string `json:"kind" validate:"nonzero" gorm:"not null;unique_index:kube_namespace_kind_name"`

	// Namespace corresponds directly to the name of the Kubernetes namespace.
	Namespace string `json:"namespace" gorm:"unique_index:kube_namespace_kind_name"`

	// Name corresponds directly to the name of the resource in Kubernetes.
	Name string `json:"name" validate:"nonzero" gorm:"not null;unique_index:kube_namespace_kind_name"`

	// Resource is where the actual Kubernetes definition is stored.
	Resource     *json.RawMessage `json:"resource" gorm:"-" sg:"store_as_json_in=ResourceJSON"`
	ResourceJSON []byte           `json:"-"`

	Template     *json.RawMessage `json:"template" gorm:"-" sg:"store_as_json_in=ResourceJSON"`
	TemplateJSON []byte           `json:"-"`
	// Started represents whether the resource exists in Kubernetes or not. If it
	// is a Pod, it also means the Pod is running.
	Started bool `json:"started" sg:"readonly"`

	// This is used to store unstructured data such as metrics from Heapster.
	ExtraData     map[string]interface{} `json:"extra_data" gorm:"-" sg:"store_as_json_in=ExtraDataJSON,readonly"`
	ExtraDataJSON []byte                 `json:"-"`
}

func (*KubeResource) SetPassiveStatus added in v0.11.0

func (m *KubeResource) SetPassiveStatus()

type KubeResourceList added in v0.11.0

type KubeResourceList struct {
	BaseList
	Items []*KubeResource `json:"items"`
}

type List added in v0.10.1

type List interface {
	QueryValues() map[string][]string
	Set(total, limit, offset int64)
}

type LoadBalancer added in v0.14.0

type LoadBalancer struct {
	BaseModel

	// belongs_to Kube
	Kube     *Kube  `json:"kube,omitempty" gorm:"ForeignKey:KubeName;AssociationForeignKey:Name"`
	KubeName string `json:"kube_name" gorm:"not null;unique_index:name_within_kube" validate:"nonzero" sg:"immutable"`

	Name string `json:"name" validate:"nonzero,max=63" gorm:"not null;unique_index:name_within_kube" sg:"immutable"`

	Namespace string `json:"namespace" validate:"nonzero" sg:"immutable"`

	Selector     map[string]string `json:"selector,omitempty" gorm:"-" sg:"store_as_json_in=SelectorJSON"`
	SelectorJSON []byte            `json:"-"`

	Ports     map[int]int `json:"ports,omitempty" gorm:"-" sg:"store_as_json_in=PortsJSON"`
	PortsJSON []byte      `json:"-"`

	Address string `json:"address" sg:"readonly"`
}

type LoadBalancerList added in v0.14.0

type LoadBalancerList struct {
	BaseList
	Items []*LoadBalancer `json:"items"`
}

type Model

type Model interface {
	GetID() interface{}
	GetUUID() string
	SetUUID() error
	SetActionStatus(*ActionStatus)
	SetPassiveStatus()
}

Model is an interface that defines the required behaviors of all stored (whether in memory or on disk) Supergiant data structure objects.

type Node

type Node struct {
	BaseModel

	// belongs_to Kube
	Kube     *Kube  `json:"kube,omitempty" gorm:"ForeignKey:KubeName;AssociationForeignKey:Name"`
	KubeName string `json:"kube_name" gorm:"not null;index" validate:"nonzero" sg:"immutable"`

	// This is the only input for Node
	Size string `json:"size" validate:"nonzero" sg:"immutable"`

	ProviderID                string    `json:"provider_id" sg:"readonly" gorm:"index"`
	Name                      string    `json:"name" sg:"readonly" gorm:"index"`
	ExternalIP                string    `json:"external_ip" sg:"readonly"`
	ProviderCreationTimestamp time.Time `json:"provider_creation_timestamp" sg:"readonly"`

	OutOfDisk bool `json:"out_of_disk" sg:"readonly"`

	ResourceMetrics
	// This is used to store unstructured data such as metrics from Heapster.
	ExtraData     map[string]interface{} `json:"extra_data" gorm:"-" sg:"store_as_json_in=ExtraDataJSON,readonly"`
	ExtraDataJSON []byte                 `json:"-"`
}

type NodeList added in v0.10.1

type NodeList struct {
	BaseList
	Items []*Node `json:"items"`
}

type OSKubeConfig added in v0.12.0

type OSKubeConfig struct {
	Region             string `json:"region" validate:"nonzero"`
	PrivateSubnetRange string `json:"private_subnet_ip_range" validate:"nonzero" sg:"default=172.20.0.0/24"`
	PublicGatwayID     string `json:"public_gateway_id" validate:"nonzero" sg:"default=disabled"`

	NetworkID    string `json:"network_id" sg:"readonly"`
	SubnetID     string `json:"subnet_id" sg:"readonly"`
	RouterID     string `json:"router_id" sg:"readonly"`
	FloatingIPID string `json:"floating_ip_id" sg:"readonly"`
	ImageName    string `json:"image_name" validate:"nonzero"`
}

OSKubeConfig holds do specific information about Open Stack based KUbernetes clusters.

type PACKKubeConfig added in v0.14.5

type PACKKubeConfig struct {
	Project   string `json:"project" validate:"nonzero"`
	ProjectID string `json:"project_id" sg:"readonly"`
	Facility  string `json:"facility" validate:"nonzero"`
}

type ResourceMetrics

type ResourceMetrics struct {
	CPUUsage int64 `json:"cpu_usage" sg:"readonly"`
	CPULimit int64 `json:"cpu_limit" sg:"readonly"`
	RAMUsage int64 `json:"ram_usage" sg:"readonly"`
	RAMLimit int64 `json:"ram_limit" sg:"readonly"`
}

type Session

type Session struct {
	ID        string    `json:"id"`
	UserID    *int64    `json:"user_id"`
	CreatedAt time.Time `json:"created_at"`

	User *User `json:"user"`
}

func (*Session) Description

func (m *Session) Description() string

func (*Session) GetID

func (m *Session) GetID() interface{}

func (*Session) GetUUID

func (m *Session) GetUUID() string

func (*Session) SetActionStatus

func (m *Session) SetActionStatus(status *ActionStatus)

func (*Session) SetPassiveStatus added in v0.11.0

func (m *Session) SetPassiveStatus()

func (*Session) SetUUID

func (m *Session) SetUUID() error

type SessionList added in v0.10.1

type SessionList struct {
	BaseList
	Items []*Session `json:"items"`
}

type TaggedModelField

type TaggedModelField struct {
	FieldName     string
	Field         reflect.Value
	Readonly      bool
	Private       bool
	Immutable     bool
	Default       interface{}
	StoreAsJSONIn *reflect.Value
	ForeignKeyOf  *BelongsToField
}

TaggedModelField holds all the information extracted from "sg" tags defined on a model's field.

func TaggedModelFieldsOf

func TaggedModelFieldsOf(r Model) (taggedFields []*TaggedModelField)

TaggedModelFieldsOf takes a Model and returns every *TaggedModelField defined (fields are gathered recursively).

type User

type User struct {
	BaseModel

	Username string `json:"username" validate:"nonzero,max=24,regexp=^[A-Za-z0-9_-]+$" gorm:"not null;unique_index"`
	Password string `json:"password,omitempty" validate:"nonzero,min=8,max=32" gorm:"-" sg:"private"`
	Role     string `json:"role" validate:"nonzero" gorm:"not null" sg:"default=user"`

	EncryptedPassword []byte `json:"-" gorm:"not null"`

	APIToken string `json:"api_token" gorm:"not null;index" sg:"readonly"`
}

func (*User) BeforeCreate

func (m *User) BeforeCreate() error

func (*User) BeforeSave

func (m *User) BeforeSave() error

func (*User) GenerateAPIToken

func (m *User) GenerateAPIToken()

type UserList added in v0.10.1

type UserList struct {
	BaseList
	Items []*User `json:"items"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL