utils

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToSnakeCase

func ToSnakeCase(str string) string

Types

type Attribute

type Attribute struct {
	ID        int
	Model     interface{}
	TypeModel interface{}
	Name      string
	Type      string
	Tag       string
	Require   bool
	Active    bool
}

Attribute represents a column of database

func DeepAttrs

func DeepAttrs(dest interface{}, incrAttrID int) (attrs []*Attribute)

DeepAttrs 递归获取所有属性

type Device

type Device struct {
	Model         interface{}
	Instances     []*Instance
	InstanceNames []string
	// contains filtered or unexported fields
}

Device represents a table of database

func Parse

func Parse(dest interface{}) *Device

Parse a struct to a Device instance

func (*Device) GetAttribute

func (d *Device) GetAttribute(instanceID int, attr string) *Attribute

GetAttribute return Attribute by id

type DeviceName

type DeviceName interface {
	DeviceName() string
}

type Instance

type Instance struct {
	ID             int
	Model          interface{}
	Name           string
	Type           string
	Tag            string
	Attributes     []*Attribute
	AttributeNames []string
	// contains filtered or unexported fields
}

func ParseInstance

func ParseInstance(dest interface{}) *Instance

ParseInstance a instance to a Instance instance

func (*Instance) GetAttribute

func (instance *Instance) GetAttribute(name string) *Attribute

GetAttribute return instance by name

type InstanceName

type InstanceName interface {
	InstanceName() string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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