domain

package
v0.0.0-...-7cbe417 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2019 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	BaseModel
	Name        string    `json:"name" binding:"required"`
	Description string    `json:"description"  `
	Owner       uuid.UUID `gorm:"INDEX,not null" json:"owner" `
}

Account to iterate with database

func (Account) TableName

func (Account) TableName() string

TableName returns Account table name

type BaseModel

type BaseModel struct {
	UUID      uuid.UUID  `gorm:"type:uuid;PRIMARY_KEY" json:"uuid"`
	CreatedAt time.Time  `json:"createdAt"`
	UpdatedAt time.Time  `json:"updatedAt"`
	DeletedAt *time.Time `json:"deletedAt"`
}

BaseModel is the base struct for tables

func (BaseModel) BeforeCreate

func (b BaseModel) BeforeCreate(scope *gorm.Scope) (err error)

BeforeCreate execute commands before creating a BaseModel

func (BaseModel) IsNew

func (b BaseModel) IsNew() bool

IsNew checks if the entity is a new record, without a proper uuid

type Category

type Category struct {
	BaseModel
	Name        string    `json:"name" binding:"required"`
	Description string    `json:"description"  `
	Parent      uuid.UUID `json:"parent" gorm:"INDEX"`
	Owner       uuid.UUID `gorm:"INDEX,not null" json:"owner" `
}

Category to iterate with database

func (Category) TableName

func (Category) TableName() string

TableName returns Category table name

type Entry

type Entry struct {
	BaseModel
	Date        time.Time `json:"date" binding:"required"`
	Type        bool      `json:"type" binding:"required"`
	Pending     bool      `json:"pending"`
	Name        string    `json:"name" binding:"required"`
	Value       float64   `json:"value" binding:"required"`
	Description string    `json:"description"  `
	IsTransfer  bool      `json:"isTransfer"`
	Origin      uuid.UUID `json:"origin"`
	Category    uuid.UUID `json:"category" binding:"required" gorm:"INDEX,not null"`
	Account     uuid.UUID `json:"account" binding:"required" gorm:"INDEX,not null"`
	Owner       uuid.UUID `gorm:"INDEX,not null" json:"owner" `
}

Entry to iterate with database

func (Entry) TableName

func (Entry) TableName() string

TableName returns Entry table name

type EntryTag

type EntryTag struct {
	BaseModel
	Entry uuid.UUID `gorm:"INDEX,not null" json:"entry" `
	Tag   uuid.UUID `gorm:"INDEX,not null" json:"tag" `
}

EntryTag is a association between Entry and Tag entities

func (EntryTag) TableName

func (EntryTag) TableName() string

TableName returns Entry table name

type Tag

type Tag struct {
	BaseModel
	Name        string    `json:"name" binding:"required"`
	Description string    `json:"description"  `
	Owner       uuid.UUID `gorm:"INDEX,not null" json:"owner" `
}

Tag to iterate with database

func (Tag) TableName

func (Tag) TableName() string

TableName returns tag table name

type User

type User struct {
	BaseModel
	FirstName string `json:"firstName" binding:"required"`
	LastName  string `json:"lastName"`
	Email     string `json:"email" gorm:"UNIQUE" binding:"required"`
	Username  string `json:"username" gorm:"UNIQUE" binding:"required"`
	Password  string `json:"password"  `
	Active    bool   `json:"active"  `
}

User domain/database representation

func (User) TableName

func (User) TableName() string

TableName set user table name

Jump to

Keyboard shortcuts

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