package state import ( "net/url" commonv1 "code.icb4dc0.de/buildr/api/generated/common/v1" "code.icb4dc0.de/buildr/buildr/modules/state/ent" "github.com/google/uuid" ) type Plugin struct { ID *uuid.UUID Name string URL *url.URL LocalPath string Hash []byte } type PluginModule struct { ID *uuid.UUID Type string DefaultSpec []byte Category commonv1.Category PluginID uuid.UUID } func pluginFromEntity(p *ent.Plugin) (Plugin, error) { u, err := url.Parse(p.URL) if err != nil { return Plugin{}, err } return Plugin{ ID: &p.ID, Name: p.Name, URL: u, LocalPath: p.LocalPath, Hash: p.Hash, }, nil }