48 lines
1.4 KiB
Go
48 lines
1.4 KiB
Go
package utils
|
|
|
|
import (
|
|
"git.dragse.it/anthrove/otter-space-sdk/pkg/models"
|
|
"git.dragse.it/anthrove/otter-space-sdk/pkg/models/graphModels"
|
|
"git.dragse.it/anthrove/otter-space-sdk/pkg/models/pgModels"
|
|
)
|
|
|
|
// GraphConvertSource converts a graphModels.AnthroveSource to a pgModels.Source
|
|
func GraphConvertSource(graphSource *graphModels.AnthroveSource) *pgModels.Source {
|
|
pgSource := &pgModels.Source{
|
|
DisplayName: graphSource.DisplayName,
|
|
Domain: graphSource.Domain,
|
|
Icon: graphSource.Icon,
|
|
}
|
|
return pgSource
|
|
}
|
|
|
|
// PostgresConvertToAnthroveSource converts a pgModels.Source to a graphModels.AnthroveSource
|
|
func PostgresConvertToAnthroveSource(pgSource *pgModels.Source) *graphModels.AnthroveSource {
|
|
graphSource := &graphModels.AnthroveSource{
|
|
DisplayName: pgSource.DisplayName,
|
|
Domain: pgSource.Domain,
|
|
Icon: pgSource.Icon,
|
|
}
|
|
|
|
return graphSource
|
|
}
|
|
|
|
// GraphConvertTag converts a graphModels.AnthroveTag to a pgModels.Tag
|
|
func GraphConvertTag(graphTag *graphModels.AnthroveTag) *pgModels.Tag {
|
|
pgTag := &pgModels.Tag{
|
|
Name: graphTag.Name,
|
|
Type: models.TagType(graphTag.Type),
|
|
}
|
|
return pgTag
|
|
}
|
|
|
|
// PostgresConvertToAnthroveTag converts a pgModels.Tag to a graphModels.AnthroveTag
|
|
func PostgresConvertToAnthroveTag(pgTag *pgModels.Tag) *graphModels.AnthroveTag {
|
|
graphTag := &graphModels.AnthroveTag{
|
|
Name: pgTag.Name,
|
|
Type: string(pgTag.Type),
|
|
}
|
|
|
|
return graphTag
|
|
}
|