model

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attribute

type Attribute struct {
	Base
	Body     string `json:"body,omitempty"`
	EntityID int    `json:"entity_id,omitempty"`

	DeletedAt gorm.DeletedAt
}

Attribute TODO Avoid dependence on gorm.

func ToAttribute

func ToAttribute(dto AttributeDTO) *Attribute

ToAttribute convert to Attribute, return Attribute pointer

func (*Attribute) SetDTO

func (attribute *Attribute) SetDTO(dto AttributeDTO)

type AttributeDTO

type AttributeDTO struct {
	ID int

	Body     string `json:"body,omitempty" binding:"required"`
	EntityID int
}

type AttributeQuery

type AttributeQuery struct {
	Query    string `form:"query"`
	Page     int    `form:"page"`
	PageSize int    `form:"page_size"`
}

Entity - A single entity.

type Base

type Base struct {
	ID        int       `json:"id,omitempty" gorm:"primary_key;"`
	CreatedAt time.Time `json:"created_time,omitempty"`
	UpdatedAt time.Time `json:"updated_time,omitempty"`
}

func (*Base) GetCreatedAt

func (base *Base) GetCreatedAt() time.Time

func (*Base) GetID

func (base *Base) GetID() int

func (*Base) GetUpdatedAt

func (base *Base) GetUpdatedAt() time.Time

func (*Base) SetCurrentTimeUpdatedAt

func (base *Base) SetCurrentTimeUpdatedAt()

func (*Base) SetID

func (base *Base) SetID(id int)

type Credential added in v0.1.4

type Credential struct {
	ID       string
	Password string
}

Entity - A single entity.

type Entity

type Entity struct {
	Base
	Body string `json:"body,omitempty"`

	DeletedAt  gorm.DeletedAt
	Attributes []Attribute `json:"attributes,omitempty"`
}

Entity - A single entity.

func ToEntity

func ToEntity(dto EntityDTO) *Entity

ToEntity convert to Entity, return Entity pointer

func (*Entity) SetRequest

func (entity *Entity) SetRequest(dto EntityDTO)

type EntityDTO

type EntityDTO struct {
	ID   int
	Body string `json:"body,omitempty"`
}

Entity - A single entity.

type EntityQuery

type EntityQuery struct {
	Query    string `form:"query"`
	Page     int    `form:"page"`
	PageSize int    `form:"page_size"`
}

Entity - A single entity.

Jump to

Keyboard shortcuts

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