gormmodels

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArrayOfStrings

type ArrayOfStrings []string

Define a custom data type for array of strings

func (ArrayOfStrings) GormDBDataType

func (aos ArrayOfStrings) GormDBDataType(db *gorm.DB, field *schema.Field) string

func (*ArrayOfStrings) Scan

func (aos *ArrayOfStrings) Scan(value interface{}) error

func (ArrayOfStrings) Value

func (aos ArrayOfStrings) Value() (driver.Value, error)

type Card

type Card struct {
	/* ---------------------------------- index --------------------------------- */
	Name     string               `gorm:"primaryKey"`
	Language protomodels.Language `gorm:"primaryKey"`

	Labels           ArrayOfStrings `gorm:"type:text;"`
	Explanations     ArrayOfStrings `gorm:"type:text;"`
	ExampleSentences ArrayOfStrings `gorm:"type:text;"`
	Familiarity      int32          `json:"omitempty"`
	ReviewDate       time.UnixTime
}

func NewCard

func NewCard(c protomodels.Card) Card

func (Card) ToProtoModel

func (c Card) ToProtoModel() protomodels.Card

type Log

type Log struct {
	Date          string `gorm:"primaryKey"`
	ReviewCards   int32
	NewCards      int32
	Streak        int32
	StreakUpdated bool
}

func NewDefaultLog

func NewDefaultLog(newStreak int32) Log

func NewLog

func NewLog(l protomodels.Log) Log

func (Log) ToProtoModel

func (l Log) ToProtoModel() protomodels.Log

func (Log) WithNewCard

func (l Log) WithNewCard() Log

func (Log) WithReviewedCard

func (l Log) WithReviewedCard() Log

type RelatedCards

type RelatedCards struct {
	/* ---------------------------------- index --------------------------------- */
	Name     string               `gorm:"primaryKey"`
	Language protomodels.Language `gorm:"primaryKey"`

	Synonyms         ArrayOfStrings `gorm:"type:text;"`
	Antonyms         ArrayOfStrings `gorm:"type:text;"`
	Origin           string
	Derivatives      ArrayOfStrings `gorm:"type:text;"`
	InOtherLanguages ArrayOfStrings `gorm:"type:text;"`
	Others           ArrayOfStrings `gorm:"type:text;"`
}

func NewRelatedCards

func NewRelatedCards(c protomodels.RelatedCards) RelatedCards

func (RelatedCards) ToProtoModel

func (rc RelatedCards) ToProtoModel() protomodels.RelatedCards

Jump to

Keyboard shortcuts

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