model

package
Version: v0.0.0-...-1580491 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	ID      int64  `gorm:"primary_key;" json:"id" groups:""`
	Code    int    `gorm:"" json:"code" groups:"error"`
	Name    string `gorm:"size:255;unique_index" json:"name" groups:"error"`
	Message string `gorm:"size:255" json:"message" groups:"error"`
}

APIError struct. Define error API struct

type Comment

type Comment struct {
	ID             uuid.UUID     `gorm:"type:uuid;primary_key;default:uuid_generate_v4()" json:"id" groups:"comment,orgComments"`
	Value          string        `gorm:"varchar(1000)" json:"value" groups:"comment,orgComments"`
	MemberID       uuid.NullUUID `gorm:"type:uuid;" json:"" groups:""`
	Member         Member        `gorm:"foreignkey:ID;association_foreignkey:MemberID" json:"member" groups:"orgComments"`
	OrganizationID uuid.NullUUID `gorm:"type:uuid;index:fk_comment_organization" json:"" groups:""`
	Organization   Organization  `gorm:"foreignkey:ID;association_foreignkey:OrganizationID;" json:"organization" groups:""`
	CreatedAt      time.Time     `gorm:"" json:"created_at" groups:"comment,orgComments"`
	UpdatedAt      time.Time     `gorm:"" json:"updated_at" groups:"comment,orgComments"`
	DeletedAt      *time.Time    `gorm:"" json:"deleted_at" groups:""`
}

Comment struct

type CommentCreate

type CommentCreate struct {
	Value string `valid:"stringlength(3|1000)~COMMENT_VALUE_INVALID" json:"value" groups:"comment"`
}

CommentCreate struct

type CommentsPagination

type CommentsPagination struct {
	Comments   []Comment  `json:"comments" groups:"orgComments"`
	Pagination Pagination `json:"pagination" groups:"orgComments"`
}

CommentsPagination struct

type Language

type Language struct {
	ID   string `gorm:"primary_key;size:5" json:"id" groups:"error,member,membersOrganization"`
	Name string `gorm:"size:100" json:"name" groups:"error,member,membersOrganization"`
}

Language struct. Define language struct

type Member

type Member struct {
	ID                  uuid.UUID            `gorm:"type:uuid;primary_key;default:uuid_generate_v4()" json:"id" groups:"member,membersOrganization"`
	Email               string               `gorm:"size:200;unique_index;" json:"email" groups:"member,orgComments,membersOrganization"`
	Username            string               `gorm:"size:200;unique_index" json:"username" groups:"member,orgComments,membersOrganization"`
	Name                string               `gorm:"size:100" json:"name" groups:"member,orgComments,membersOrganization"`
	Avatar              string               `gorm:"size:255" json:"avatar" groups:"member,membersOrganization,orgComments"`
	LanguageID          string               `gorm:"size:5" json:"" groups:""`
	Language            Language             `gorm:"foreignkey:ID;association_foreignkey:LanguageID" json:"language" groups:"member,membersOrganization"`
	Password            string               `gorm:"size:255" json:"" groups:""`
	FollowerCount       int64                `gorm:"index:fk_member_follower" json:"follower_count" groups:"membersOrganization"`
	FollowingCount      int64                `gorm:"" json:"following_count" groups:"membersOrganization"`
	OrganizationMembers []OrganizationMember `gorm:"foreignkey:MemberID;association_foreignkey:ID" json:"organization_members" groups:"member"`
	CreatedAt           time.Time            `gorm:"" json:"created_at" groups:"member,membersOrganization"`
	UpdatedAt           time.Time            `gorm:"" json:"updated_at" groups:"member,membersOrganization"`
	DeletedAt           *time.Time           `gorm:"" json:"deleted_at" groups:"member"`
}

Member struct. Define member struct

func (*Member) AfterFind

func (member *Member) AfterFind() (err error)

AfterFind member hook function

func (*Member) BeforeSave

func (member *Member) BeforeSave() (err error)

BeforeSave member hook function

func (*Member) BeforeUpdate

func (member *Member) BeforeUpdate() (err error)

BeforeUpdate member hook function

type MembersPagination

type MembersPagination struct {
	Members    []Member   `json:"members" groups:"membersOrganization"`
	Pagination Pagination `json:"pagination" groups:"membersOrganization"`
}

MembersPagination struct

type Organization

type Organization struct {
	ID        uuid.UUID  `gorm:"type:uuid;primary_key;default:uuid_generate_v4()" json:"id" groups:"member"`
	Code      string     `gorm:"size:50;unique_index" json:"code" groups:"member"`
	Name      string     `gorm:"size:100" json:"name" groups:"member"`
	Comments  []Comment  `gorm:"foreignkey:CommentID;association_foreignkey:ID" json:"comments" groups:""`
	CreatedAt time.Time  `gorm:"" json:"created_at" groups:""`
	UpdatedAt time.Time  `gorm:"" json:"updated_at" groups:""`
	DeletedAt *time.Time `gorm:"" json:"deleted_at" groups:""`
}

Organization struct. Define organization struct

type OrganizationMember

type OrganizationMember struct {
	ID             uuid.UUID     `gorm:"type:uuid;primary_key;default:uuid_generate_v4()" json:"id" groups:""`
	OrganizationID uuid.NullUUID `gorm:"type:uuid" json:"" groups:""`
	Organization   Organization  `gorm:"foreignkey:ID;association_foreignkey:OrganizationID" json:"organization" groups:"member"`
	MemberID       uuid.NullUUID `gorm:"type:uuid" json:"" groups:""`
	Member         Member        `gorm:"foreignkey:ID;association_foreignkey:MemberID" json:"member" groups:""`
	CreatedAt      time.Time     `gorm:"" json:"created_at" groups:"member"`
	UpdatedAt      time.Time     `gorm:"" json:"updated_at" groups:""`
	DeletedAt      *time.Time    `gorm:"" json:"deleted_at" groups:""`
}

OrganizationMember struct. Define organization member struct

type Pagination

type Pagination struct {
	Page    int64 `json:"page" groups:"orgComments,membersOrganization"`
	PerPage int64 `json:"per_page" groups:"orgComments,membersOrganization"`
}

Pagination struct

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL