types

package
v0.0.0-...-e5fa651 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ArrayType = "array"
)

Variables

View Source
var AdRatioField = Field{
	Name:          "ad_ratio",
	CanBeSelected: true,
	CanBeFiltered: true,
	Table:         OccurrenceTable,
}
View Source
var AfField = Field{
	Name:          "af",
	CanBeSelected: true,
	CanBeFiltered: true,
	CanBeSorted:   true,
	Table:         VariantTable,
}
View Source
var ChromosomeField = Field{
	Name:            "chromosome",
	CanBeSelected:   true,
	CanBeFiltered:   true,
	CanBeSorted:     true,
	CanBeAggregated: true,
	Table:           OccurrenceTable,
}
View Source
var ClinvarField = Field{
	Name:            "clinvar_interpretation",
	Alias:           "clinvar",
	CanBeSelected:   true,
	CanBeFiltered:   true,
	CanBeSorted:     false,
	CanBeAggregated: true,
	Type:            ArrayType,
	Table:           VariantTable,
}
View Source
var ConsequenceFilterTable = Table{
	Name:  "consequences_filter",
	Alias: "cf",
}
View Source
var ConsequenceIdField = Field{
	Name:            "consequence_id",
	CanBeFiltered:   true,
	CanBeAggregated: true,
	Table:           ConsequenceFilterTable,
}
View Source
var FilterField = Field{
	Name:            "filter",
	CanBeSelected:   true,
	CanBeFiltered:   true,
	CanBeAggregated: true,
	Table:           OccurrenceTable,
}
View Source
var HgvsgField = Field{
	Name:          "hgvsg",
	CanBeSelected: true,
	CanBeFiltered: true,
	CanBeSorted:   true,
	Table:         VariantTable,
}
View Source
var ImpactScoreField = Field{
	Name:            "impact_score",
	CanBeFiltered:   true,
	CanBeAggregated: true,
	Table:           ConsequenceFilterTable,
}
View Source
var LocusIdField = Field{
	Name:          "locus_id",
	CanBeSelected: true,
	CanBeFiltered: true,
	CanBeSorted:   true,
	Table:         OccurrenceTable,
}
View Source
var OccurrenceTable = Table{
	Name:  "occurrences",
	Alias: "o",
}
View Source
var PfField = Field{
	Name:          "pf",
	CanBeSelected: true,
	CanBeFiltered: true,
	CanBeSorted:   true,
	Table:         VariantTable,
}
View Source
var QualityField = Field{
	Name:          "quality",
	CanBeSelected: true,
	CanBeFiltered: true,
	Table:         OccurrenceTable,
}
View Source
var SeqIdField = Field{
	Name:          "seq_id",
	CanBeSelected: true,
	CanBeFiltered: true,
	Table:         OccurrenceTable,
}
View Source
var SiftPredField = Field{
	Name:            "sift_pred",
	CanBeFiltered:   true,
	CanBeAggregated: true,
	Table:           ConsequenceFilterTable,
}
View Source
var SymbolField = Field{
	Name:            "symbol",
	CanBeFiltered:   true,
	CanBeAggregated: true,
	Table:           ConsequenceFilterTable,
}
View Source
var VariantClassField = Field{
	Name:            "variant_class",
	CanBeSelected:   true,
	CanBeFiltered:   true,
	CanBeSorted:     true,
	CanBeAggregated: true,
	Table:           VariantTable,
}
View Source
var VariantTable = Table{
	Name:  "variants",
	Alias: "v",
}
View Source
var ZygosityField = Field{
	Name:            "zygosity",
	CanBeSelected:   true,
	CanBeFiltered:   true,
	CanBeAggregated: true,
	Table:           OccurrenceTable,
}

Functions

This section is empty.

Types

type AggQuery

type AggQuery interface {
	Filters() FilterNode
	GetAggregateField() Field
	HasFieldFromTable(table Table) bool
}

func NewAggregationQuery

func NewAggregationQuery(aggregation string, sqon *SQON, fields []Field) (AggQuery, error)

type Aggregation

type Aggregation struct {
	Bucket string `json:"key"`
	Count  int64  `json:"count"`
}

type AggregationBody

type AggregationBody struct {
	Field string
	SQON  *SQON
	Size  int
}

type AndNode

type AndNode struct {
	Children []FilterNode
}

func (*AndNode) GetChildren

func (n *AndNode) GetChildren() []FilterNode

func (*AndNode) ToSQL

func (n *AndNode) ToSQL() (string, []interface{})

type ComparisonNode

type ComparisonNode struct {
	Operator string
	Value    interface{}
	Field    Field
}

func (*ComparisonNode) ToSQL

func (n *ComparisonNode) ToSQL() (string, []interface{})

type CountBody

type CountBody struct {
	SQON *SQON `json:"sqon"`
}

type CountQuery

type CountQuery interface {
	Filters() FilterNode
	HasFieldFromTable(table Table) bool
}

func NewCountQuery

func NewCountQuery(sqon *SQON, fields []Field) (CountQuery, error)

type Field

type Field struct {
	Name            string // Name of the field, correspond to column name
	Alias           string // Alias of the field to use in query
	CanBeSelected   bool   // Whether the field is authorized for selection
	CanBeFiltered   bool   // Whether the field is authorized for filtering
	CanBeSorted     bool   // Whether the field is authorized for sorting
	CanBeAggregated bool   // Whether the field is authorized for aggregation
	CustomOp        string // Custom operation, e.g., "array_contains"
	DefaultOp       string // Default operation to use if no custom one exists
	Table           Table  // Table to which the field belongs
	Type            string // Type of the field
}

func (*Field) GetAlias

func (f *Field) GetAlias() string

GetAlias returns the alias of the field if it is set, otherwise returns the name

func (*Field) IsArray

func (f *Field) IsArray() bool

type FilterNode

type FilterNode interface {
	ToSQL() (string, []interface{})
}

type FilterNodeWithChildren

type FilterNodeWithChildren interface {
	ToSQL() (string, []interface{})
	GetChildren() []FilterNode
}

type ListBody

type ListBody struct {
	SelectedFields []string   `json:"selected_fields"`
	SQON           *SQON      `json:"sqon"`
	Limit          int        `json:"limit"`
	Offset         int        `json:"offset"`
	Sort           []SortBody `json:"sort"`
}

type ListQuery

type ListQuery interface {
	SelectedFields() []Field
	Filters() FilterNode
	Pagination() *Pagination
	SortedFields() []SortField
	HasFieldFromTable(table Table) bool
}

func NewListQuery

func NewListQuery(selected []string, sqon *SQON, fields []Field, pagination *Pagination, sorted []SortBody) (ListQuery, error)

type NotNode

type NotNode struct {
	Child FilterNode
}

func (*NotNode) ToSQL

func (n *NotNode) ToSQL() (string, []interface{})

type Occurrence

type Occurrence struct {
	SeqId               int                     `json:"seq_id,omitempty"`
	Chromosome          string                  `json:"chromosome,omitempty"`
	LocusId             int64                   `json:"locus_id,omitempty"`
	Quality             float32                 `json:"quality,omitempty"`
	Filter              string                  `json:"filter,omitempty"`
	Zygosity            string                  `json:"zygosity,omitempty"`
	Pf                  float64                 `json:"pf,omitempty"`
	Af                  float64                 `json:"af,omitempty"`
	GnomadV3Af          float64                 `json:"gnomad_v3_af,omitempty"`
	Hgvsg               string                  `json:"hgvsg,omitempty"`
	OmimInheritanceCode string                  `json:"omim_inheritance_code,omitempty"`
	AdRatio             float64                 `json:"ad_ratio,omitempty"`
	VariantClass        string                  `json:"variant_class,omitempty"`
	VepImpact           string                  `json:"vep_impact,omitempty"`
	Symbol              string                  `json:"symbol,omitempty"`
	Clinvar             utils.JsonArray[string] `gorm:"type:json" json:"clinvar,omitempty"`
	ManeSelect          bool                    `json:"mane_select,omitempty"`
	Canonical           bool                    `json:"canonical,omitempty"`
}

type OrNode

type OrNode struct {
	Children []FilterNode
}

func (*OrNode) GetChildren

func (n *OrNode) GetChildren() []FilterNode

func (*OrNode) ToSQL

func (n *OrNode) ToSQL() (string, []interface{})

type Pagination

type Pagination struct {
	Limit  int //Limit the number of results
	Offset int //Offset the results
}

type Query

type Query interface {
	Filters() FilterNode
	HasFieldFromTable(table Table) bool
}

type SQON

type SQON struct {
	Field   string      `json:"field,omitempty"`   // Field to filter on (for leaf nodes)
	Value   interface{} `json:"value,omitempty"`   // Value(s) for the filter
	Content []SQON      `json:"content,omitempty"` // Nested SQON (for "not" or nested filters)
	Op      string      `json:"op,omitempty"`      // Operation at this node
}

type SortBody

type SortBody struct {
	Field string `json:"field"`
	Order string `json:"order"`
}

type SortField

type SortField struct {
	Field Field
	Order string
}

type Table

type Table struct {
	Name  string // Name of the table
	Alias string // Alias of the table to use in query
}

Jump to

Keyboard shortcuts

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