models

package
v0.0.0-...-584605b Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2022 License: Apache-2.0 Imports: 7 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 {
	Name   string  `json:"name" bson:"name"`
	Values []Value `json:"values" bson:"values"`
}

func (Attribute) GetName

func (a Attribute) GetName() string

func (Attribute) GetValue

func (a Attribute) GetValue() Value

* Get Last Value of Attribute by default

func (Attribute) GetValueByDate

func (a Attribute) GetValueByDate(date time.Time) Value

* Get Value of Attribute by date

func (Attribute) GetValues

func (a Attribute) GetValues() []Value

func (Attribute) SetName

func (a Attribute) SetName(name string) Attribute

func (Attribute) SetValue

func (a Attribute) SetValue(value Value) Attribute

* Set New Value to Attribute

type CategoryGroupWiseCount

type CategoryGroupWiseCount struct {
	CategoryGroup []string `json:"_id" bson:"_id"`
	Count         int      `json:"category_count" bson:"category_count"`
}

type CategoryWiseCount

type CategoryWiseCount struct {
	Category string `json:"_id" bson:"_id"`
	Count    int    `json:"category_count" bson:"category_count"`
}

type Entity

type Entity struct {
	Id              bson.ObjectId        `json:"id" bson:"_id,omitempty"`
	Title           string               `json:"title" bson:"title"`
	ImageURL        string               `json:"image_url" bson:"image_url"`
	Source          string               `json:"source" bson:"source"`
	SourceSignature string               `json:"source_signature" bson:"source_signature"`
	SourceDate      time.Time            `json:"source_date" bson:"source_date"`
	Attributes      map[string]Attribute `json:"attributes" bson:"attributes"`
	Links           []Link               `json:"links" bson:"links"`
	Categories      []string             `json:"categories" bson:"categories"`
	CreatedAt       time.Time            `json:"created_at" bson:"created_at"`
	UpdatedAt       time.Time            `json:"updated_at" bson:"updated_at"`
	Snippet         string               `json:"snippet" bson:"snippet"`
	SearchText      string               `json:"search_text" bson:"search_text"`
}

* It is recommended to use get,set functions to access values of the entity. Directly modify attributes only if you know what you are doing.

func (Entity) AddCategories

func (e Entity) AddCategories(categories []string) Entity

* Add new categories to entity

func (Entity) AddCategory

func (e Entity) AddCategory(category string) Entity

* Add new category to entity

func (e Entity) AddLink(link Link) Entity

* Add new link to entity

func (e Entity) AddLinks(links []Link) Entity

* Add new links to entity

func (Entity) GetAttribute

func (e Entity) GetAttribute(attributeName string) (Attribute, error)

* Get an attribute

func (Entity) GetAttributes

func (e Entity) GetAttributes() map[string]Attribute

func (Entity) GetCategories

func (e Entity) GetCategories() []string

func (Entity) GetCreatedDate

func (e Entity) GetCreatedDate() time.Time

func (Entity) GetId

func (e Entity) GetId() bson.ObjectId

func (Entity) GetImageURL

func (e Entity) GetImageURL() string

func (Entity) GetLinkTitles

func (e Entity) GetLinkTitles() []string
func (e Entity) GetLinks() []Link

func (Entity) GetSnippet

func (e Entity) GetSnippet() string

func (Entity) GetSource

func (e Entity) GetSource() string

func (Entity) GetSourceDate

func (e Entity) GetSourceDate() time.Time

func (Entity) GetSourceSignature

func (e Entity) GetSourceSignature() string

func (Entity) GetTitle

func (e Entity) GetTitle() string

func (Entity) GetUpdatedDate

func (e Entity) GetUpdatedDate() time.Time

func (Entity) HasContent

func (e Entity) HasContent() bool

* Check if the entity has data

func (Entity) IsNil

func (e Entity) IsNil() bool

* Check if the entity has no title, data

func (Entity) IsTerminated

func (e Entity) IsTerminated() bool

func (Entity) NewEntity

func (e Entity) NewEntity() Entity

func (Entity) RemoveAttribute

func (e Entity) RemoveAttribute(attributeName string) Entity

func (Entity) RemoveCategories

func (e Entity) RemoveCategories(categories []string) Entity

* remove categories from the entity

func (Entity) SetAttribute

func (e Entity) SetAttribute(attributeName string, value Value) Entity

* Add or update an existing attribute with a new value

func (Entity) SetImageURL

func (e Entity) SetImageURL(value string) Entity

func (Entity) SetSnippet

func (e Entity) SetSnippet() Entity

* Create snippet for the entity

func (Entity) SetSource

func (e Entity) SetSource(value string) Entity

func (Entity) SetSourceDate

func (e Entity) SetSourceDate(value time.Time) Entity

func (Entity) SetSourceSignature

func (e Entity) SetSourceSignature(value string) Entity

func (Entity) SetTitle

func (e Entity) SetTitle(titleValue Value) Entity

type EntityStats

type EntityStats struct {
	Id                     bson.ObjectId            `json:"-" bson:"_id,omitempty"`
	EntityCount            int                      `json:"entity_count" bson:"entity_count"`
	RelationCount          int                      `json:"relation_count" bson:"relation_count"`
	CategoryWiseCount      []CategoryWiseCount      `json:"category_wise_count" bson:"category_wise_count"`
	CategoryGroupWiseCount []CategoryGroupWiseCount `json:"category_group_wise_count" bson:"category_group_wise_count"`
	CreatedAt              time.Time                `json:"created_at" bson:"created_at"`
}

* It is recommended to use get,set functions to access values of the entity. Directly modify attributes only if you know what you are doing.

type Link struct {
	Title string      `json:"title" bson:"title"`
	Dates []time.Time `json:"dates" bson:"dates"`
}

func (Link) AddDate

func (l Link) AddDate(date time.Time) Link

func (Link) GetDates

func (l Link) GetDates() []time.Time

func (Link) GetTitle

func (l Link) GetTitle() string

func (Link) SetTitle

func (l Link) SetTitle(title string) Link

type Login

type Login struct {
	Username string `json:"username" bson:"username"`
	Password string `json:"password" bson:"password"`
}

swagger:model

type NERResult

type NERResult struct {
	Category   string
	EntityName string
}

func (NERResult) GetCategory

func (n NERResult) GetCategory() string

func (NERResult) GetEntityName

func (n NERResult) GetEntityName() string

func (NERResult) SetCategory

func (n NERResult) SetCategory(value string) NERResult

func (NERResult) SetEntityName

func (n NERResult) SetEntityName(value string) NERResult

type NewReader

type NewReader struct {
	Email    string `json:"email" bson:"email"`
	Password string `json:"password" bson:"password"`
}

swagger:model

type NewUser

type NewUser struct {
	Name     string `json:"name" bson:"name"`
	Email    string `json:"email" bson:"email"`
	Role     string `json:"role" bson:"role"`
	Password string `json:"password" bson:"password"`
}

swagger:model

type NormalizedName

type NormalizedName struct {
	Id             bson.ObjectId `json:"id" bson:"_id"`
	SearchText     string        `json:"search_text" bson:"search_text"`
	NormalizedText string        `json:"normalized_text" bson:"normalized_text"`
	CreatedAt      time.Time     `json:"created_at" bson:"created_at"`
}

func (NormalizedName) GetCreatedDate

func (n NormalizedName) GetCreatedDate() time.Time

func (NormalizedName) GetNormalizedText

func (n NormalizedName) GetNormalizedText() string

func (NormalizedName) GetSearchText

func (n NormalizedName) GetSearchText() string

func (NormalizedName) NewNormalizedName

func (n NormalizedName) NewNormalizedName() NormalizedName

func (NormalizedName) SetNormalizedText

func (n NormalizedName) SetNormalizedText(value string) NormalizedName

func (NormalizedName) SetSearchText

func (n NormalizedName) SetSearchText(value string) NormalizedName

type SearchResult

type SearchResult struct {
	Title      string               `json:"title" bson:"title"`
	Snippet    string               `json:"snippet" bson:"snippet"`
	Categories []string             `json:"categories" bson:"categories"`
	Attributes map[string]Attribute `json:"attributes" bson:"attributes"`
	Links      []Link               `json:"links" bson:"links"`
	SourceDate time.Time            `json:"source_date" bson:"source_date"`
	Source     string               `json:"source" bson:"source"`
	CreatedAt  time.Time            `json:"created_at" bson:"created_at"`
	UpdatedAt  time.Time            `json:"updated_at" bson:"updated_at"`
	ImageURL   string               `json:"image_url" bson:"image_url"`
}

swagger:model

func (SearchResult) ResultFrom

func (s SearchResult) ResultFrom(entity Entity, attributes []string) SearchResult

type Upload

type Upload struct {
	Source string `json:"source" bson:"source"`
	Title  string `json:"title" bson:"title"`
}

swagger:model

func (Upload) GetSource

func (u Upload) GetSource() string

func (Upload) GetTitle

func (u Upload) GetTitle() string

func (Upload) SetSource

func (u Upload) SetSource(value string) Upload

func (Upload) SetTitle

func (u Upload) SetTitle(value string) Upload

type User

type User struct {
	Id       bson.ObjectId `json:"id" bson:"_id,omitempty"`
	Name     string        `json:"name" bson:"name"`
	Email    string        `json:"email" bson:"email"`
	Role     string        `json:"role" bson:"role"`
	Password []byte        `json:"-"`
	ApiKey   string        `json:"apikey" bson:"apikey"`
}

swagger:model

func (User) GetId

func (e User) GetId() bson.ObjectId

type UserToken

type UserToken struct {
	Name  string `json:"name" bson:"name"`
	Email string `json:"email" bson:"email"`
	Role  string `json:"role" bson:"role"`
	Token string `json:"token" bson:"token"`
}

swagger:model

type Value

type Value struct {
	ValueType   string    `json:"value_type" bson:"value_type"`
	ValueString string    `json:"value_string" bson:"value_string"`
	Source      string    `json:"source" bson:"source"`
	Date        time.Time `json:"date" bson:"date"`
	UpdatedAt   time.Time `json:"updated_at" bson:"updated_at"`
}

func (Value) GetDate

func (v Value) GetDate() time.Time

func (Value) GetSource

func (v Value) GetSource() string

func (Value) GetType

func (v Value) GetType() string

func (Value) GetUpdatedDate

func (v Value) GetUpdatedDate() time.Time

func (Value) GetValueString

func (v Value) GetValueString() string

func (Value) SetDate

func (v Value) SetDate(value time.Time) Value

func (Value) SetSource

func (v Value) SetSource(value string) Value

func (Value) SetType

func (v Value) SetType(valueType string) Value

func (Value) SetValueString

func (v Value) SetValueString(value string) Value

Jump to

Keyboard shortcuts

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