entity

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetNodeBodyDB

func GetNodeBodyDB(ctx context.Context, defDB *gorm.DB) *gorm.DB

GetNodeDB - Get the Node store

func GetNodeDB

func GetNodeDB(ctx context.Context, defDB *gorm.DB) *gorm.DB

GetNodeDB - Get the Node store

func GetPrimitiveBodyDB

func GetPrimitiveBodyDB(ctx context.Context, defDB *gorm.DB) *gorm.DB

GetPrimitiveDB - Get the Primitive store

func GetPrimitiveDB

func GetPrimitiveDB(ctx context.Context, defDB *gorm.DB) *gorm.DB

GetPrimitiveDB - Get the Primitive store

Types

type Node

type Node struct {
	entity.Model
	UUID       string          `gorm:"column:uuid;size:36;index;"`               // UUID
	User       account.User    `gorm:"foreignkey:UID;association_foreignkey:ID"` // Creator User ID
	UID        int             `gorm:"column:uid;"`                              // Creator User ID
	Primitive  string          `gorm:"column:primitive;size:100;"`               // Primitive Slug
	Slug       string          `gorm:"column:slug;size:100;unique_index;"`       // Slug short machine name
	Parent     string          `gorm:"column:parent;size:100;unique_index;"`     // Slug short machine name
	ParentPath string          `gorm:"column:parent_path"`                       // Parent path
	Status     int             `gorm:"column:status"`                            // Staus (1: published, 0: unpublished)
	References json.RawMessage `gorm:"column:references;type:jsonb;"`            // References in JSON Format
	NodeBodies NodeBodies
}

Node - Node entity

func (Node) String

func (a Node) String() string

func (Node) TableName

func (a Node) TableName() string

TableName - Table Name

func (Node) ToSchemaNode

func (a Node) ToSchemaNode() *schema.Node

ToSchemaNode - Convert to Node object

type NodeBodies

type NodeBodies []*NodeBody

NodeBodies - NodeBody lassociated entity ist

func (NodeBodies) GetByNodeID

func (a NodeBodies) GetByNodeID(UUID string) []*schema.NodeBody

GetByNodeID - Get Node Body list based on Node ID

func (NodeBodies) ToMap

func (a NodeBodies) ToMap() map[string]*NodeBody

ToMap - Convert to key-value mapping

func (NodeBodies) ToSchemaNodeBodies

func (a NodeBodies) ToSchemaNodeBodies() []*schema.NodeBody

ToSchemaNodeBodies - Convert to Node Body variations action list

type NodeBody

type NodeBody struct {
	Node      Node          `gorm:"foreignkey:Slug;association_foreignkey:Slug"` // Node ID
	NID       string        `gorm:"column:nid"`                                  // Node ID
	User      account.User  `gorm:"foreignkey:UID;association_foreignkey:ID"`    // Creator User ID
	UID       int           `gorm:"column:uid;"`                                 // Creator User ID
	Language  i18n.Language `gorm:"foreignkey:Lang;association_foreignkey:Code"` // Language Code Identifieru se Code as foreign key
	Lang      string        `gorm:"column:language"`                             // Language Code Identifieru se Code as foreign key
	Title     *string       `gorm:"column:title" binding:"required"`             // Node Title
	Body      *string       `gorm:"column:body"`                                 // Node Body
	CreatedAt time.Time     `gorm:"column:created_at"`                           // Creation time
	UpdatedAt time.Time     `gorm:"column:updated_at"`                           // Updated time
}

Node Body - Node Body object

func (NodeBody) TableName

func (a NodeBody) TableName() string

TableName - Table Name

func (NodeBody) ToSchemaNodeBody

func (a NodeBody) ToSchemaNodeBody() *schema.NodeBody

ToSchemaNodeBody - Convert to Node Body object

type Nodes

type Nodes []*Node

Nodes - Node list

func (Nodes) ToSchemaNodes

func (a Nodes) ToSchemaNodes() []*schema.Node

ToSchemaNodes - Convert to Node object list

type Primitive

type Primitive struct {
	entity.Model
	UUID       string          `gorm:"column:uuid;size:36;index;"`               // UUID
	User       account.User    `gorm:"foreignkey:UID;association_foreignkey:ID"` // Creator User ID
	UID        int             `gorm:"column:uid;"`                              // Creator User ID
	Slug       string          `gorm:"column:slug;size:100;unique_index;"`       // Slug short machine name
	Parent     string          `gorm:"column:parent;size:100;unique_index;"`     // Slug short machine name
	ParentPath string          `gorm:"column:parent_path"`                       // Parent path
	Options    json.RawMessage `gorm:"column:options;type:jsonb;"`               // Options in Jeson Format
	Variations Variations
}

Primitive - Primitive entity

func (Primitive) String

func (a Primitive) String() string

func (Primitive) TableName

func (a Primitive) TableName() string

TableName - Table Name

func (Primitive) ToSchemaPrimitive

func (a Primitive) ToSchemaPrimitive() *schema.Primitive

ToSchemaPrimitive - Convert to Primitive object

type PrimitiveBody

type PrimitiveBody struct {
	Primitive Primitive     `gorm:"foreignkey:Slug;association_foreignkey:Slug"` // Primitive ID Slug
	Slug      string        `gorm:"column:slug"`                                 // Primitive ID Slug
	User      account.User  `gorm:"foreignkey:UID;association_foreignkey:ID"`    // Creator User ID
	UID       int           `gorm:"column:uid;"`                                 // Creator User ID
	Language  i18n.Language `gorm:"foreignkey:Lang;association_foreignkey:Code"` // Language Code Identifieru se Code as foreign key
	Lang      string        `gorm:"column:language"`                             // Language Code Identifieru se Code as foreign key
	Title     *string       `gorm:"column:title" binding:"required"`             // Primitive Title
	Body      *string       `gorm:"column:body"`                                 // Primitive Body
	CreatedAt time.Time     `gorm:"column:created_at"`                           // Creation time
	UpdatedAt time.Time     `gorm:"column:updated_at"`                           // Updated time
}

Primitive Body - Primitive Body object

func (PrimitiveBody) TableName

func (a PrimitiveBody) TableName() string

TableName - Table Name

func (PrimitiveBody) ToSchemaPrimitiveBody

func (a PrimitiveBody) ToSchemaPrimitiveBody() *schema.PrimitiveBody

ToSchemaPrimitiveBody - Convert to Primitive Body object

type Primitives

type Primitives []*Primitive

Primitives - Primitive list

func (Primitives) ToSchemaPrimitives

func (a Primitives) ToSchemaPrimitives() []*schema.Primitive

ToSchemaPrimitives - Convert to Primitive object list

type SchemaNode

type SchemaNode schema.Node

SchemaNode - Node object

func (SchemaNode) ToNode

func (a SchemaNode) ToNode() *Node

ToNode - Convert to Node entity

func (SchemaNode) ToNodeBodies

func (a SchemaNode) ToNodeBodies() []*NodeBody

ToPermissionActions - Convert to permission action list

type SchemaNodeBody

type SchemaNodeBody schema.NodeBody

SchemaNodeBody NodeBody action object

func (SchemaNodeBody) ToNodeBody

func (a SchemaNodeBody) ToNodeBody(NID string) *NodeBody

ToNodeBody - Convert to Node Body entity

type SchemaPrimitive

type SchemaPrimitive schema.Primitive

SchemaPrimitive - Primitive object

func (SchemaPrimitive) ToPrimitive

func (a SchemaPrimitive) ToPrimitive() *Primitive

ToPrimitive - Convert to Primitive entity

func (SchemaPrimitive) ToVariations

func (a SchemaPrimitive) ToVariations() []*PrimitiveBody

ToPermissionActions - Convert to permission action list

type SchemaPrimitiveBody

type SchemaPrimitiveBody schema.PrimitiveBody

SchemaPrimitiveBody PrimitiveBody action object

func (SchemaPrimitiveBody) ToPrimitiveBody

func (a SchemaPrimitiveBody) ToPrimitiveBody(Slug string) *PrimitiveBody

ToPrimitiveBody - Convert to Primitive Body entity

type Variations

type Variations []*PrimitiveBody

Variations - PrimitiveBody lassociated entity ist

func (Variations) GetByPrimitiveID

func (a Variations) GetByPrimitiveID(Slug string) []*schema.PrimitiveBody

GetByPrimitiveID - Get Primitive Body list based on Primitive ID

func (Variations) ToMap

func (a Variations) ToMap() map[string]*PrimitiveBody

ToMap - Convert to key-value mapping

func (Variations) ToSchemaVariations

func (a Variations) ToSchemaVariations() []*schema.PrimitiveBody

ToSchemaVariations - Convert to Primitive Body variations action list

Jump to

Keyboard shortcuts

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