refactor!: add missing fields and docs

This commit is contained in:
DevMiner 2024-08-22 23:03:38 +02:00
parent 61891d891a
commit 6e59386f60
73 changed files with 726 additions and 580 deletions

View file

@ -13,7 +13,7 @@ import (
"github.com/google/uuid"
"github.com/lysand-org/versia-go/ent/attachment"
"github.com/lysand-org/versia-go/ent/user"
"github.com/lysand-org/versia-go/pkg/lysand"
"github.com/lysand-org/versia-go/pkg/versia"
)
// Attachment is the model entity for the Attachment schema.
@ -26,7 +26,7 @@ type Attachment struct {
// URI holds the value of the "uri" field.
URI string `json:"uri,omitempty"`
// Extensions holds the value of the "extensions" field.
Extensions lysand.Extensions `json:"extensions,omitempty"`
Extensions versia.Extensions `json:"extensions,omitempty"`
// CreatedAt holds the value of the "created_at" field.
CreatedAt time.Time `json:"created_at,omitempty"`
// UpdatedAt holds the value of the "updated_at" field.

View file

@ -8,7 +8,7 @@ import (
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"github.com/google/uuid"
"github.com/lysand-org/versia-go/pkg/lysand"
"github.com/lysand-org/versia-go/pkg/versia"
)
const (
@ -99,7 +99,7 @@ var (
// URIValidator is a validator for the "uri" field. It is called by the builders before save.
URIValidator func(string) error
// DefaultExtensions holds the default value on creation for the "extensions" field.
DefaultExtensions lysand.Extensions
DefaultExtensions versia.Extensions
// DefaultCreatedAt holds the default value on creation for the "created_at" field.
DefaultCreatedAt func() time.Time
// DefaultUpdatedAt holds the default value on creation for the "updated_at" field.

View file

@ -15,7 +15,7 @@ import (
"github.com/google/uuid"
"github.com/lysand-org/versia-go/ent/attachment"
"github.com/lysand-org/versia-go/ent/user"
"github.com/lysand-org/versia-go/pkg/lysand"
"github.com/lysand-org/versia-go/pkg/versia"
)
// AttachmentCreate is the builder for creating a Attachment entity.
@ -39,8 +39,8 @@ func (ac *AttachmentCreate) SetURI(s string) *AttachmentCreate {
}
// SetExtensions sets the "extensions" field.
func (ac *AttachmentCreate) SetExtensions(l lysand.Extensions) *AttachmentCreate {
ac.mutation.SetExtensions(l)
func (ac *AttachmentCreate) SetExtensions(v versia.Extensions) *AttachmentCreate {
ac.mutation.SetExtensions(v)
return ac
}
@ -454,7 +454,7 @@ func (u *AttachmentUpsert) UpdateURI() *AttachmentUpsert {
}
// SetExtensions sets the "extensions" field.
func (u *AttachmentUpsert) SetExtensions(v lysand.Extensions) *AttachmentUpsert {
func (u *AttachmentUpsert) SetExtensions(v versia.Extensions) *AttachmentUpsert {
u.Set(attachment.FieldExtensions, v)
return u
}
@ -701,7 +701,7 @@ func (u *AttachmentUpsertOne) UpdateURI() *AttachmentUpsertOne {
}
// SetExtensions sets the "extensions" field.
func (u *AttachmentUpsertOne) SetExtensions(v lysand.Extensions) *AttachmentUpsertOne {
func (u *AttachmentUpsertOne) SetExtensions(v versia.Extensions) *AttachmentUpsertOne {
return u.Update(func(s *AttachmentUpsert) {
s.SetExtensions(v)
})
@ -1143,7 +1143,7 @@ func (u *AttachmentUpsertBulk) UpdateURI() *AttachmentUpsertBulk {
}
// SetExtensions sets the "extensions" field.
func (u *AttachmentUpsertBulk) SetExtensions(v lysand.Extensions) *AttachmentUpsertBulk {
func (u *AttachmentUpsertBulk) SetExtensions(v versia.Extensions) *AttachmentUpsertBulk {
return u.Update(func(s *AttachmentUpsert) {
s.SetExtensions(v)
})

View file

@ -15,7 +15,7 @@ import (
"github.com/lysand-org/versia-go/ent/attachment"
"github.com/lysand-org/versia-go/ent/predicate"
"github.com/lysand-org/versia-go/ent/user"
"github.com/lysand-org/versia-go/pkg/lysand"
"github.com/lysand-org/versia-go/pkg/versia"
)
// AttachmentUpdate is the builder for updating Attachment entities.
@ -60,8 +60,8 @@ func (au *AttachmentUpdate) SetNillableURI(s *string) *AttachmentUpdate {
}
// SetExtensions sets the "extensions" field.
func (au *AttachmentUpdate) SetExtensions(l lysand.Extensions) *AttachmentUpdate {
au.mutation.SetExtensions(l)
func (au *AttachmentUpdate) SetExtensions(v versia.Extensions) *AttachmentUpdate {
au.mutation.SetExtensions(v)
return au
}
@ -453,8 +453,8 @@ func (auo *AttachmentUpdateOne) SetNillableURI(s *string) *AttachmentUpdateOne {
}
// SetExtensions sets the "extensions" field.
func (auo *AttachmentUpdateOne) SetExtensions(l lysand.Extensions) *AttachmentUpdateOne {
auo.mutation.SetExtensions(l)
func (auo *AttachmentUpdateOne) SetExtensions(v versia.Extensions) *AttachmentUpdateOne {
auo.mutation.SetExtensions(v)
return auo
}

View file

@ -13,7 +13,7 @@ import (
"github.com/google/uuid"
"github.com/lysand-org/versia-go/ent/follow"
"github.com/lysand-org/versia-go/ent/user"
"github.com/lysand-org/versia-go/pkg/lysand"
"github.com/lysand-org/versia-go/pkg/versia"
)
// Follow is the model entity for the Follow schema.
@ -26,7 +26,7 @@ type Follow struct {
// URI holds the value of the "uri" field.
URI string `json:"uri,omitempty"`
// Extensions holds the value of the "extensions" field.
Extensions lysand.Extensions `json:"extensions,omitempty"`
Extensions versia.Extensions `json:"extensions,omitempty"`
// CreatedAt holds the value of the "created_at" field.
CreatedAt time.Time `json:"created_at,omitempty"`
// UpdatedAt holds the value of the "updated_at" field.

View file

@ -9,7 +9,7 @@ import (
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"github.com/google/uuid"
"github.com/lysand-org/versia-go/pkg/lysand"
"github.com/lysand-org/versia-go/pkg/versia"
)
const (
@ -88,7 +88,7 @@ var (
// URIValidator is a validator for the "uri" field. It is called by the builders before save.
URIValidator func(string) error
// DefaultExtensions holds the default value on creation for the "extensions" field.
DefaultExtensions lysand.Extensions
DefaultExtensions versia.Extensions
// DefaultCreatedAt holds the default value on creation for the "created_at" field.
DefaultCreatedAt func() time.Time
// DefaultUpdatedAt holds the default value on creation for the "updated_at" field.

View file

@ -15,7 +15,7 @@ import (
"github.com/google/uuid"
"github.com/lysand-org/versia-go/ent/follow"
"github.com/lysand-org/versia-go/ent/user"
"github.com/lysand-org/versia-go/pkg/lysand"
"github.com/lysand-org/versia-go/pkg/versia"
)
// FollowCreate is the builder for creating a Follow entity.
@ -39,8 +39,8 @@ func (fc *FollowCreate) SetURI(s string) *FollowCreate {
}
// SetExtensions sets the "extensions" field.
func (fc *FollowCreate) SetExtensions(l lysand.Extensions) *FollowCreate {
fc.mutation.SetExtensions(l)
func (fc *FollowCreate) SetExtensions(v versia.Extensions) *FollowCreate {
fc.mutation.SetExtensions(v)
return fc
}
@ -386,7 +386,7 @@ func (u *FollowUpsert) UpdateURI() *FollowUpsert {
}
// SetExtensions sets the "extensions" field.
func (u *FollowUpsert) SetExtensions(v lysand.Extensions) *FollowUpsert {
func (u *FollowUpsert) SetExtensions(v versia.Extensions) *FollowUpsert {
u.Set(follow.FieldExtensions, v)
return u
}
@ -501,7 +501,7 @@ func (u *FollowUpsertOne) UpdateURI() *FollowUpsertOne {
}
// SetExtensions sets the "extensions" field.
func (u *FollowUpsertOne) SetExtensions(v lysand.Extensions) *FollowUpsertOne {
func (u *FollowUpsertOne) SetExtensions(v versia.Extensions) *FollowUpsertOne {
return u.Update(func(s *FollowUpsert) {
s.SetExtensions(v)
})
@ -789,7 +789,7 @@ func (u *FollowUpsertBulk) UpdateURI() *FollowUpsertBulk {
}
// SetExtensions sets the "extensions" field.
func (u *FollowUpsertBulk) SetExtensions(v lysand.Extensions) *FollowUpsertBulk {
func (u *FollowUpsertBulk) SetExtensions(v versia.Extensions) *FollowUpsertBulk {
return u.Update(func(s *FollowUpsert) {
s.SetExtensions(v)
})

View file

@ -15,7 +15,7 @@ import (
"github.com/lysand-org/versia-go/ent/follow"
"github.com/lysand-org/versia-go/ent/predicate"
"github.com/lysand-org/versia-go/ent/user"
"github.com/lysand-org/versia-go/pkg/lysand"
"github.com/lysand-org/versia-go/pkg/versia"
)
// FollowUpdate is the builder for updating Follow entities.
@ -60,8 +60,8 @@ func (fu *FollowUpdate) SetNillableURI(s *string) *FollowUpdate {
}
// SetExtensions sets the "extensions" field.
func (fu *FollowUpdate) SetExtensions(l lysand.Extensions) *FollowUpdate {
fu.mutation.SetExtensions(l)
func (fu *FollowUpdate) SetExtensions(v versia.Extensions) *FollowUpdate {
fu.mutation.SetExtensions(v)
return fu
}
@ -315,8 +315,8 @@ func (fuo *FollowUpdateOne) SetNillableURI(s *string) *FollowUpdateOne {
}
// SetExtensions sets the "extensions" field.
func (fuo *FollowUpdateOne) SetExtensions(l lysand.Extensions) *FollowUpdateOne {
fuo.mutation.SetExtensions(l)
func (fuo *FollowUpdateOne) SetExtensions(v versia.Extensions) *FollowUpdateOne {
fuo.mutation.SetExtensions(v)
return fuo
}

View file

@ -12,7 +12,7 @@ import (
"entgo.io/ent/dialect/sql"
"github.com/google/uuid"
"github.com/lysand-org/versia-go/ent/instancemetadata"
"github.com/lysand-org/versia-go/pkg/lysand"
"github.com/lysand-org/versia-go/pkg/versia"
)
// InstanceMetadata is the model entity for the InstanceMetadata schema.
@ -25,7 +25,7 @@ type InstanceMetadata struct {
// URI holds the value of the "uri" field.
URI string `json:"uri,omitempty"`
// Extensions holds the value of the "extensions" field.
Extensions lysand.Extensions `json:"extensions,omitempty"`
Extensions versia.Extensions `json:"extensions,omitempty"`
// CreatedAt holds the value of the "created_at" field.
CreatedAt time.Time `json:"created_at,omitempty"`
// UpdatedAt holds the value of the "updated_at" field.

View file

@ -8,7 +8,7 @@ import (
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"github.com/google/uuid"
"github.com/lysand-org/versia-go/pkg/lysand"
"github.com/lysand-org/versia-go/pkg/versia"
)
const (
@ -138,7 +138,7 @@ var (
// URIValidator is a validator for the "uri" field. It is called by the builders before save.
URIValidator func(string) error
// DefaultExtensions holds the default value on creation for the "extensions" field.
DefaultExtensions lysand.Extensions
DefaultExtensions versia.Extensions
// DefaultCreatedAt holds the default value on creation for the "created_at" field.
DefaultCreatedAt func() time.Time
// DefaultUpdatedAt holds the default value on creation for the "updated_at" field.

View file

@ -15,7 +15,7 @@ import (
"github.com/google/uuid"
"github.com/lysand-org/versia-go/ent/instancemetadata"
"github.com/lysand-org/versia-go/ent/user"
"github.com/lysand-org/versia-go/pkg/lysand"
"github.com/lysand-org/versia-go/pkg/versia"
)
// InstanceMetadataCreate is the builder for creating a InstanceMetadata entity.
@ -39,8 +39,8 @@ func (imc *InstanceMetadataCreate) SetURI(s string) *InstanceMetadataCreate {
}
// SetExtensions sets the "extensions" field.
func (imc *InstanceMetadataCreate) SetExtensions(l lysand.Extensions) *InstanceMetadataCreate {
imc.mutation.SetExtensions(l)
func (imc *InstanceMetadataCreate) SetExtensions(v versia.Extensions) *InstanceMetadataCreate {
imc.mutation.SetExtensions(v)
return imc
}
@ -703,7 +703,7 @@ func (u *InstanceMetadataUpsert) UpdateURI() *InstanceMetadataUpsert {
}
// SetExtensions sets the "extensions" field.
func (u *InstanceMetadataUpsert) SetExtensions(v lysand.Extensions) *InstanceMetadataUpsert {
func (u *InstanceMetadataUpsert) SetExtensions(v versia.Extensions) *InstanceMetadataUpsert {
u.Set(instancemetadata.FieldExtensions, v)
return u
}
@ -1058,7 +1058,7 @@ func (u *InstanceMetadataUpsertOne) UpdateURI() *InstanceMetadataUpsertOne {
}
// SetExtensions sets the "extensions" field.
func (u *InstanceMetadataUpsertOne) SetExtensions(v lysand.Extensions) *InstanceMetadataUpsertOne {
func (u *InstanceMetadataUpsertOne) SetExtensions(v versia.Extensions) *InstanceMetadataUpsertOne {
return u.Update(func(s *InstanceMetadataUpsert) {
s.SetExtensions(v)
})
@ -1626,7 +1626,7 @@ func (u *InstanceMetadataUpsertBulk) UpdateURI() *InstanceMetadataUpsertBulk {
}
// SetExtensions sets the "extensions" field.
func (u *InstanceMetadataUpsertBulk) SetExtensions(v lysand.Extensions) *InstanceMetadataUpsertBulk {
func (u *InstanceMetadataUpsertBulk) SetExtensions(v versia.Extensions) *InstanceMetadataUpsertBulk {
return u.Update(func(s *InstanceMetadataUpsert) {
s.SetExtensions(v)
})

View file

@ -16,7 +16,7 @@ import (
"github.com/lysand-org/versia-go/ent/instancemetadata"
"github.com/lysand-org/versia-go/ent/predicate"
"github.com/lysand-org/versia-go/ent/user"
"github.com/lysand-org/versia-go/pkg/lysand"
"github.com/lysand-org/versia-go/pkg/versia"
)
// InstanceMetadataUpdate is the builder for updating InstanceMetadata entities.
@ -61,8 +61,8 @@ func (imu *InstanceMetadataUpdate) SetNillableURI(s *string) *InstanceMetadataUp
}
// SetExtensions sets the "extensions" field.
func (imu *InstanceMetadataUpdate) SetExtensions(l lysand.Extensions) *InstanceMetadataUpdate {
imu.mutation.SetExtensions(l)
func (imu *InstanceMetadataUpdate) SetExtensions(v versia.Extensions) *InstanceMetadataUpdate {
imu.mutation.SetExtensions(v)
return imu
}
@ -845,8 +845,8 @@ func (imuo *InstanceMetadataUpdateOne) SetNillableURI(s *string) *InstanceMetada
}
// SetExtensions sets the "extensions" field.
func (imuo *InstanceMetadataUpdateOne) SetExtensions(l lysand.Extensions) *InstanceMetadataUpdateOne {
imuo.mutation.SetExtensions(l)
func (imuo *InstanceMetadataUpdateOne) SetExtensions(v versia.Extensions) *InstanceMetadataUpdateOne {
imuo.mutation.SetExtensions(v)
return imuo
}

File diff suppressed because one or more lines are too long

View file

@ -19,7 +19,7 @@ import (
"github.com/lysand-org/versia-go/ent/note"
"github.com/lysand-org/versia-go/ent/predicate"
"github.com/lysand-org/versia-go/ent/user"
"github.com/lysand-org/versia-go/pkg/lysand"
"github.com/lysand-org/versia-go/pkg/versia"
)
const (
@ -47,7 +47,7 @@ type AttachmentMutation struct {
id *uuid.UUID
isRemote *bool
uri *string
extensions *lysand.Extensions
extensions *versia.Extensions
created_at *time.Time
updated_at *time.Time
description *string
@ -247,12 +247,12 @@ func (m *AttachmentMutation) ResetURI() {
}
// SetExtensions sets the "extensions" field.
func (m *AttachmentMutation) SetExtensions(l lysand.Extensions) {
m.extensions = &l
func (m *AttachmentMutation) SetExtensions(v versia.Extensions) {
m.extensions = &v
}
// Extensions returns the value of the "extensions" field in the mutation.
func (m *AttachmentMutation) Extensions() (r lysand.Extensions, exists bool) {
func (m *AttachmentMutation) Extensions() (r versia.Extensions, exists bool) {
v := m.extensions
if v == nil {
return
@ -263,7 +263,7 @@ func (m *AttachmentMutation) Extensions() (r lysand.Extensions, exists bool) {
// OldExtensions returns the old "extensions" field's value of the Attachment entity.
// If the Attachment object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *AttachmentMutation) OldExtensions(ctx context.Context) (v lysand.Extensions, err error) {
func (m *AttachmentMutation) OldExtensions(ctx context.Context) (v versia.Extensions, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldExtensions is only allowed on UpdateOne operations")
}
@ -983,7 +983,7 @@ func (m *AttachmentMutation) SetField(name string, value ent.Value) error {
m.SetURI(v)
return nil
case attachment.FieldExtensions:
v, ok := value.(lysand.Extensions)
v, ok := value.(versia.Extensions)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
@ -1311,7 +1311,7 @@ type FollowMutation struct {
id *uuid.UUID
isRemote *bool
uri *string
extensions *lysand.Extensions
extensions *versia.Extensions
created_at *time.Time
updated_at *time.Time
status *follow.Status
@ -1502,12 +1502,12 @@ func (m *FollowMutation) ResetURI() {
}
// SetExtensions sets the "extensions" field.
func (m *FollowMutation) SetExtensions(l lysand.Extensions) {
m.extensions = &l
func (m *FollowMutation) SetExtensions(v versia.Extensions) {
m.extensions = &v
}
// Extensions returns the value of the "extensions" field in the mutation.
func (m *FollowMutation) Extensions() (r lysand.Extensions, exists bool) {
func (m *FollowMutation) Extensions() (r versia.Extensions, exists bool) {
v := m.extensions
if v == nil {
return
@ -1518,7 +1518,7 @@ func (m *FollowMutation) Extensions() (r lysand.Extensions, exists bool) {
// OldExtensions returns the old "extensions" field's value of the Follow entity.
// If the Follow object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *FollowMutation) OldExtensions(ctx context.Context) (v lysand.Extensions, err error) {
func (m *FollowMutation) OldExtensions(ctx context.Context) (v versia.Extensions, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldExtensions is only allowed on UpdateOne operations")
}
@ -1841,7 +1841,7 @@ func (m *FollowMutation) SetField(name string, value ent.Value) error {
m.SetURI(v)
return nil
case follow.FieldExtensions:
v, ok := value.(lysand.Extensions)
v, ok := value.(versia.Extensions)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
@ -2419,7 +2419,7 @@ type InstanceMetadataMutation struct {
id *uuid.UUID
isRemote *bool
uri *string
extensions *lysand.Extensions
extensions *versia.Extensions
created_at *time.Time
updated_at *time.Time
name *string
@ -2633,12 +2633,12 @@ func (m *InstanceMetadataMutation) ResetURI() {
}
// SetExtensions sets the "extensions" field.
func (m *InstanceMetadataMutation) SetExtensions(l lysand.Extensions) {
m.extensions = &l
func (m *InstanceMetadataMutation) SetExtensions(v versia.Extensions) {
m.extensions = &v
}
// Extensions returns the value of the "extensions" field in the mutation.
func (m *InstanceMetadataMutation) Extensions() (r lysand.Extensions, exists bool) {
func (m *InstanceMetadataMutation) Extensions() (r versia.Extensions, exists bool) {
v := m.extensions
if v == nil {
return
@ -2649,7 +2649,7 @@ func (m *InstanceMetadataMutation) Extensions() (r lysand.Extensions, exists boo
// OldExtensions returns the old "extensions" field's value of the InstanceMetadata entity.
// If the InstanceMetadata object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *InstanceMetadataMutation) OldExtensions(ctx context.Context) (v lysand.Extensions, err error) {
func (m *InstanceMetadataMutation) OldExtensions(ctx context.Context) (v versia.Extensions, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldExtensions is only allowed on UpdateOne operations")
}
@ -3878,7 +3878,7 @@ func (m *InstanceMetadataMutation) SetField(name string, value ent.Value) error
m.SetURI(v)
return nil
case instancemetadata.FieldExtensions:
v, ok := value.(lysand.Extensions)
v, ok := value.(versia.Extensions)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
@ -4331,7 +4331,7 @@ type NoteMutation struct {
id *uuid.UUID
isRemote *bool
uri *string
extensions *lysand.Extensions
extensions *versia.Extensions
created_at *time.Time
updated_at *time.Time
subject *string
@ -4529,12 +4529,12 @@ func (m *NoteMutation) ResetURI() {
}
// SetExtensions sets the "extensions" field.
func (m *NoteMutation) SetExtensions(l lysand.Extensions) {
m.extensions = &l
func (m *NoteMutation) SetExtensions(v versia.Extensions) {
m.extensions = &v
}
// Extensions returns the value of the "extensions" field in the mutation.
func (m *NoteMutation) Extensions() (r lysand.Extensions, exists bool) {
func (m *NoteMutation) Extensions() (r versia.Extensions, exists bool) {
v := m.extensions
if v == nil {
return
@ -4545,7 +4545,7 @@ func (m *NoteMutation) Extensions() (r lysand.Extensions, exists bool) {
// OldExtensions returns the old "extensions" field's value of the Note entity.
// If the Note object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *NoteMutation) OldExtensions(ctx context.Context) (v lysand.Extensions, err error) {
func (m *NoteMutation) OldExtensions(ctx context.Context) (v versia.Extensions, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldExtensions is only allowed on UpdateOne operations")
}
@ -5079,7 +5079,7 @@ func (m *NoteMutation) SetField(name string, value ent.Value) error {
m.SetURI(v)
return nil
case note.FieldExtensions:
v, ok := value.(lysand.Extensions)
v, ok := value.(versia.Extensions)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
@ -5352,7 +5352,7 @@ type UserMutation struct {
id *uuid.UUID
isRemote *bool
uri *string
extensions *lysand.Extensions
extensions *versia.Extensions
created_at *time.Time
updated_at *time.Time
username *string
@ -5365,8 +5365,8 @@ type UserMutation struct {
privateKey *[]byte
indexable *bool
privacyLevel *user.PrivacyLevel
fields *[]lysand.Field
appendfields []lysand.Field
fields *[]versia.UserField
appendfields []versia.UserField
inbox *string
featured *string
followers *string
@ -5574,12 +5574,12 @@ func (m *UserMutation) ResetURI() {
}
// SetExtensions sets the "extensions" field.
func (m *UserMutation) SetExtensions(l lysand.Extensions) {
m.extensions = &l
func (m *UserMutation) SetExtensions(v versia.Extensions) {
m.extensions = &v
}
// Extensions returns the value of the "extensions" field in the mutation.
func (m *UserMutation) Extensions() (r lysand.Extensions, exists bool) {
func (m *UserMutation) Extensions() (r versia.Extensions, exists bool) {
v := m.extensions
if v == nil {
return
@ -5590,7 +5590,7 @@ func (m *UserMutation) Extensions() (r lysand.Extensions, exists bool) {
// OldExtensions returns the old "extensions" field's value of the User entity.
// If the User object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *UserMutation) OldExtensions(ctx context.Context) (v lysand.Extensions, err error) {
func (m *UserMutation) OldExtensions(ctx context.Context) (v versia.Extensions, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldExtensions is only allowed on UpdateOne operations")
}
@ -6094,13 +6094,13 @@ func (m *UserMutation) ResetPrivacyLevel() {
}
// SetFields sets the "fields" field.
func (m *UserMutation) SetFields(l []lysand.Field) {
m.fields = &l
func (m *UserMutation) SetFields(vf []versia.UserField) {
m.fields = &vf
m.appendfields = nil
}
// GetFields returns the value of the "fields" field in the mutation.
func (m *UserMutation) GetFields() (r []lysand.Field, exists bool) {
func (m *UserMutation) GetFields() (r []versia.UserField, exists bool) {
v := m.fields
if v == nil {
return
@ -6111,7 +6111,7 @@ func (m *UserMutation) GetFields() (r []lysand.Field, exists bool) {
// OldFields returns the old "fields" field's value of the User entity.
// If the User object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *UserMutation) OldFields(ctx context.Context) (v []lysand.Field, err error) {
func (m *UserMutation) OldFields(ctx context.Context) (v []versia.UserField, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldFields is only allowed on UpdateOne operations")
}
@ -6125,13 +6125,13 @@ func (m *UserMutation) OldFields(ctx context.Context) (v []lysand.Field, err err
return oldValue.Fields, nil
}
// AppendFields adds l to the "fields" field.
func (m *UserMutation) AppendFields(l []lysand.Field) {
m.appendfields = append(m.appendfields, l...)
// AppendFields adds vf to the "fields" field.
func (m *UserMutation) AppendFields(vf []versia.UserField) {
m.appendfields = append(m.appendfields, vf...)
}
// AppendedFields returns the list of values that were appended to the "fields" field in this mutation.
func (m *UserMutation) AppendedFields() ([]lysand.Field, bool) {
func (m *UserMutation) AppendedFields() ([]versia.UserField, bool) {
if len(m.appendfields) == 0 {
return nil, false
}
@ -6895,7 +6895,7 @@ func (m *UserMutation) SetField(name string, value ent.Value) error {
m.SetURI(v)
return nil
case user.FieldExtensions:
v, ok := value.(lysand.Extensions)
v, ok := value.(versia.Extensions)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
@ -6986,7 +6986,7 @@ func (m *UserMutation) SetField(name string, value ent.Value) error {
m.SetPrivacyLevel(v)
return nil
case user.FieldFields:
v, ok := value.([]lysand.Field)
v, ok := value.([]versia.UserField)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}

View file

@ -13,7 +13,7 @@ import (
"github.com/google/uuid"
"github.com/lysand-org/versia-go/ent/note"
"github.com/lysand-org/versia-go/ent/user"
"github.com/lysand-org/versia-go/pkg/lysand"
"github.com/lysand-org/versia-go/pkg/versia"
)
// Note is the model entity for the Note schema.
@ -26,7 +26,7 @@ type Note struct {
// URI holds the value of the "uri" field.
URI string `json:"uri,omitempty"`
// Extensions holds the value of the "extensions" field.
Extensions lysand.Extensions `json:"extensions,omitempty"`
Extensions versia.Extensions `json:"extensions,omitempty"`
// CreatedAt holds the value of the "created_at" field.
CreatedAt time.Time `json:"created_at,omitempty"`
// UpdatedAt holds the value of the "updated_at" field.

View file

@ -9,7 +9,7 @@ import (
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"github.com/google/uuid"
"github.com/lysand-org/versia-go/pkg/lysand"
"github.com/lysand-org/versia-go/pkg/versia"
)
const (
@ -109,7 +109,7 @@ var (
// URIValidator is a validator for the "uri" field. It is called by the builders before save.
URIValidator func(string) error
// DefaultExtensions holds the default value on creation for the "extensions" field.
DefaultExtensions lysand.Extensions
DefaultExtensions versia.Extensions
// DefaultCreatedAt holds the default value on creation for the "created_at" field.
DefaultCreatedAt func() time.Time
// DefaultUpdatedAt holds the default value on creation for the "updated_at" field.

View file

@ -16,7 +16,7 @@ import (
"github.com/lysand-org/versia-go/ent/attachment"
"github.com/lysand-org/versia-go/ent/note"
"github.com/lysand-org/versia-go/ent/user"
"github.com/lysand-org/versia-go/pkg/lysand"
"github.com/lysand-org/versia-go/pkg/versia"
)
// NoteCreate is the builder for creating a Note entity.
@ -40,8 +40,8 @@ func (nc *NoteCreate) SetURI(s string) *NoteCreate {
}
// SetExtensions sets the "extensions" field.
func (nc *NoteCreate) SetExtensions(l lysand.Extensions) *NoteCreate {
nc.mutation.SetExtensions(l)
func (nc *NoteCreate) SetExtensions(v versia.Extensions) *NoteCreate {
nc.mutation.SetExtensions(v)
return nc
}
@ -479,7 +479,7 @@ func (u *NoteUpsert) UpdateURI() *NoteUpsert {
}
// SetExtensions sets the "extensions" field.
func (u *NoteUpsert) SetExtensions(v lysand.Extensions) *NoteUpsert {
func (u *NoteUpsert) SetExtensions(v versia.Extensions) *NoteUpsert {
u.Set(note.FieldExtensions, v)
return u
}
@ -636,7 +636,7 @@ func (u *NoteUpsertOne) UpdateURI() *NoteUpsertOne {
}
// SetExtensions sets the "extensions" field.
func (u *NoteUpsertOne) SetExtensions(v lysand.Extensions) *NoteUpsertOne {
func (u *NoteUpsertOne) SetExtensions(v versia.Extensions) *NoteUpsertOne {
return u.Update(func(s *NoteUpsert) {
s.SetExtensions(v)
})
@ -973,7 +973,7 @@ func (u *NoteUpsertBulk) UpdateURI() *NoteUpsertBulk {
}
// SetExtensions sets the "extensions" field.
func (u *NoteUpsertBulk) SetExtensions(v lysand.Extensions) *NoteUpsertBulk {
func (u *NoteUpsertBulk) SetExtensions(v versia.Extensions) *NoteUpsertBulk {
return u.Update(func(s *NoteUpsert) {
s.SetExtensions(v)
})

View file

@ -16,7 +16,7 @@ import (
"github.com/lysand-org/versia-go/ent/note"
"github.com/lysand-org/versia-go/ent/predicate"
"github.com/lysand-org/versia-go/ent/user"
"github.com/lysand-org/versia-go/pkg/lysand"
"github.com/lysand-org/versia-go/pkg/versia"
)
// NoteUpdate is the builder for updating Note entities.
@ -61,8 +61,8 @@ func (nu *NoteUpdate) SetNillableURI(s *string) *NoteUpdate {
}
// SetExtensions sets the "extensions" field.
func (nu *NoteUpdate) SetExtensions(l lysand.Extensions) *NoteUpdate {
nu.mutation.SetExtensions(l)
func (nu *NoteUpdate) SetExtensions(v versia.Extensions) *NoteUpdate {
nu.mutation.SetExtensions(v)
return nu
}
@ -494,8 +494,8 @@ func (nuo *NoteUpdateOne) SetNillableURI(s *string) *NoteUpdateOne {
}
// SetExtensions sets the "extensions" field.
func (nuo *NoteUpdateOne) SetExtensions(l lysand.Extensions) *NoteUpdateOne {
nuo.mutation.SetExtensions(l)
func (nuo *NoteUpdateOne) SetExtensions(v versia.Extensions) *NoteUpdateOne {
nuo.mutation.SetExtensions(v)
return nuo
}

View file

@ -13,7 +13,7 @@ import (
"github.com/lysand-org/versia-go/ent/note"
"github.com/lysand-org/versia-go/ent/schema"
"github.com/lysand-org/versia-go/ent/user"
"github.com/lysand-org/versia-go/pkg/lysand"
"github.com/lysand-org/versia-go/pkg/versia"
)
// The init function reads all schema descriptors with runtime code
@ -32,7 +32,7 @@ func init() {
// attachmentDescExtensions is the schema descriptor for extensions field.
attachmentDescExtensions := attachmentMixinFields0[3].Descriptor()
// attachment.DefaultExtensions holds the default value on creation for the extensions field.
attachment.DefaultExtensions = attachmentDescExtensions.Default.(lysand.Extensions)
attachment.DefaultExtensions = attachmentDescExtensions.Default.(versia.Extensions)
// attachmentDescCreatedAt is the schema descriptor for created_at field.
attachmentDescCreatedAt := attachmentMixinFields0[4].Descriptor()
// attachment.DefaultCreatedAt holds the default value on creation for the created_at field.
@ -63,7 +63,7 @@ func init() {
// followDescExtensions is the schema descriptor for extensions field.
followDescExtensions := followMixinFields0[3].Descriptor()
// follow.DefaultExtensions holds the default value on creation for the extensions field.
follow.DefaultExtensions = followDescExtensions.Default.(lysand.Extensions)
follow.DefaultExtensions = followDescExtensions.Default.(versia.Extensions)
// followDescCreatedAt is the schema descriptor for created_at field.
followDescCreatedAt := followMixinFields0[4].Descriptor()
// follow.DefaultCreatedAt holds the default value on creation for the created_at field.
@ -96,7 +96,7 @@ func init() {
// instancemetadataDescExtensions is the schema descriptor for extensions field.
instancemetadataDescExtensions := instancemetadataMixinFields0[3].Descriptor()
// instancemetadata.DefaultExtensions holds the default value on creation for the extensions field.
instancemetadata.DefaultExtensions = instancemetadataDescExtensions.Default.(lysand.Extensions)
instancemetadata.DefaultExtensions = instancemetadataDescExtensions.Default.(versia.Extensions)
// instancemetadataDescCreatedAt is the schema descriptor for created_at field.
instancemetadataDescCreatedAt := instancemetadataMixinFields0[4].Descriptor()
// instancemetadata.DefaultCreatedAt holds the default value on creation for the created_at field.
@ -175,7 +175,7 @@ func init() {
// noteDescExtensions is the schema descriptor for extensions field.
noteDescExtensions := noteMixinFields0[3].Descriptor()
// note.DefaultExtensions holds the default value on creation for the extensions field.
note.DefaultExtensions = noteDescExtensions.Default.(lysand.Extensions)
note.DefaultExtensions = noteDescExtensions.Default.(versia.Extensions)
// noteDescCreatedAt is the schema descriptor for created_at field.
noteDescCreatedAt := noteMixinFields0[4].Descriptor()
// note.DefaultCreatedAt holds the default value on creation for the created_at field.
@ -210,7 +210,7 @@ func init() {
// userDescExtensions is the schema descriptor for extensions field.
userDescExtensions := userMixinFields0[3].Descriptor()
// user.DefaultExtensions holds the default value on creation for the extensions field.
user.DefaultExtensions = userDescExtensions.Default.(lysand.Extensions)
user.DefaultExtensions = userDescExtensions.Default.(versia.Extensions)
// userDescCreatedAt is the schema descriptor for created_at field.
userDescCreatedAt := userMixinFields0[4].Descriptor()
// user.DefaultCreatedAt holds the default value on creation for the created_at field.
@ -250,7 +250,7 @@ func init() {
// userDescFields is the schema descriptor for fields field.
userDescFields := userFields[10].Descriptor()
// user.DefaultFields holds the default value on creation for the fields field.
user.DefaultFields = userDescFields.Default.([]lysand.Field)
user.DefaultFields = userDescFields.Default.([]versia.UserField)
// userDescInbox is the schema descriptor for inbox field.
userDescInbox := userFields[11].Descriptor()
// user.InboxValidator is a validator for the "inbox" field. It is called by the builders before save.

View file

@ -1,14 +1,13 @@
package schema
import (
"net/url"
"time"
"entgo.io/ent"
"entgo.io/ent/schema/field"
"entgo.io/ent/schema/mixin"
"github.com/google/uuid"
"github.com/lysand-org/versia-go/pkg/lysand"
"github.com/lysand-org/versia-go/pkg/versia"
"net/url"
"time"
)
type LysandEntityMixin struct{ mixin.Schema }
@ -23,7 +22,7 @@ func (LysandEntityMixin) Fields() []ent.Field {
field.Bool("isRemote"),
field.String("uri").Validate(ValidateURI),
field.JSON("extensions", lysand.Extensions{}).Default(lysand.Extensions{}),
field.JSON("extensions", versia.Extensions{}).Default(versia.Extensions{}),
field.Time("created_at").
Immutable().

View file

@ -1,13 +1,12 @@
package schema
import (
"errors"
"regexp"
"entgo.io/ent"
"entgo.io/ent/schema/edge"
"entgo.io/ent/schema/field"
"github.com/lysand-org/versia-go/pkg/lysand"
"errors"
"github.com/lysand-org/versia-go/pkg/versia"
"regexp"
)
var (
@ -45,7 +44,7 @@ func (User) Fields() []ent.Field {
Values("public", "restricted", "private").
Default("public"),
field.JSON("fields", []lysand.Field{}).Default([]lysand.Field{}),
field.JSON("fields", []versia.UserField{}).Default([]versia.UserField{}),
field.String("inbox").Validate(ValidateURI),

View file

@ -13,7 +13,7 @@ import (
"github.com/google/uuid"
"github.com/lysand-org/versia-go/ent/image"
"github.com/lysand-org/versia-go/ent/user"
"github.com/lysand-org/versia-go/pkg/lysand"
"github.com/lysand-org/versia-go/pkg/versia"
)
// User is the model entity for the User schema.
@ -26,7 +26,7 @@ type User struct {
// URI holds the value of the "uri" field.
URI string `json:"uri,omitempty"`
// Extensions holds the value of the "extensions" field.
Extensions lysand.Extensions `json:"extensions,omitempty"`
Extensions versia.Extensions `json:"extensions,omitempty"`
// CreatedAt holds the value of the "created_at" field.
CreatedAt time.Time `json:"created_at,omitempty"`
// UpdatedAt holds the value of the "updated_at" field.
@ -52,7 +52,7 @@ type User struct {
// PrivacyLevel holds the value of the "privacyLevel" field.
PrivacyLevel user.PrivacyLevel `json:"privacyLevel,omitempty"`
// Fields holds the value of the "fields" field.
Fields []lysand.Field `json:"fields,omitempty"`
Fields []versia.UserField `json:"fields,omitempty"`
// Inbox holds the value of the "inbox" field.
Inbox string `json:"inbox,omitempty"`
// Featured holds the value of the "featured" field.

View file

@ -9,7 +9,7 @@ import (
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"github.com/google/uuid"
"github.com/lysand-org/versia-go/pkg/lysand"
"github.com/lysand-org/versia-go/pkg/versia"
)
const (
@ -185,7 +185,7 @@ var (
// URIValidator is a validator for the "uri" field. It is called by the builders before save.
URIValidator func(string) error
// DefaultExtensions holds the default value on creation for the "extensions" field.
DefaultExtensions lysand.Extensions
DefaultExtensions versia.Extensions
// DefaultCreatedAt holds the default value on creation for the "created_at" field.
DefaultCreatedAt func() time.Time
// DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
@ -199,7 +199,7 @@ var (
// DefaultIndexable holds the default value on creation for the "indexable" field.
DefaultIndexable bool
// DefaultFields holds the default value on creation for the "fields" field.
DefaultFields []lysand.Field
DefaultFields []versia.UserField
// InboxValidator is a validator for the "inbox" field. It is called by the builders before save.
InboxValidator func(string) error
// FeaturedValidator is a validator for the "featured" field. It is called by the builders before save.

View file

@ -17,7 +17,7 @@ import (
"github.com/lysand-org/versia-go/ent/instancemetadata"
"github.com/lysand-org/versia-go/ent/note"
"github.com/lysand-org/versia-go/ent/user"
"github.com/lysand-org/versia-go/pkg/lysand"
"github.com/lysand-org/versia-go/pkg/versia"
)
// UserCreate is the builder for creating a User entity.
@ -41,8 +41,8 @@ func (uc *UserCreate) SetURI(s string) *UserCreate {
}
// SetExtensions sets the "extensions" field.
func (uc *UserCreate) SetExtensions(l lysand.Extensions) *UserCreate {
uc.mutation.SetExtensions(l)
func (uc *UserCreate) SetExtensions(v versia.Extensions) *UserCreate {
uc.mutation.SetExtensions(v)
return uc
}
@ -167,8 +167,8 @@ func (uc *UserCreate) SetNillablePrivacyLevel(ul *user.PrivacyLevel) *UserCreate
}
// SetFields sets the "fields" field.
func (uc *UserCreate) SetFields(l []lysand.Field) *UserCreate {
uc.mutation.SetFields(l)
func (uc *UserCreate) SetFields(vf []versia.UserField) *UserCreate {
uc.mutation.SetFields(vf)
return uc
}
@ -803,7 +803,7 @@ func (u *UserUpsert) UpdateURI() *UserUpsert {
}
// SetExtensions sets the "extensions" field.
func (u *UserUpsert) SetExtensions(v lysand.Extensions) *UserUpsert {
func (u *UserUpsert) SetExtensions(v versia.Extensions) *UserUpsert {
u.Set(user.FieldExtensions, v)
return u
}
@ -971,7 +971,7 @@ func (u *UserUpsert) UpdatePrivacyLevel() *UserUpsert {
}
// SetFields sets the "fields" field.
func (u *UserUpsert) SetFields(v []lysand.Field) *UserUpsert {
func (u *UserUpsert) SetFields(v []versia.UserField) *UserUpsert {
u.Set(user.FieldFields, v)
return u
}
@ -1122,7 +1122,7 @@ func (u *UserUpsertOne) UpdateURI() *UserUpsertOne {
}
// SetExtensions sets the "extensions" field.
func (u *UserUpsertOne) SetExtensions(v lysand.Extensions) *UserUpsertOne {
func (u *UserUpsertOne) SetExtensions(v versia.Extensions) *UserUpsertOne {
return u.Update(func(s *UserUpsert) {
s.SetExtensions(v)
})
@ -1318,7 +1318,7 @@ func (u *UserUpsertOne) UpdatePrivacyLevel() *UserUpsertOne {
}
// SetFields sets the "fields" field.
func (u *UserUpsertOne) SetFields(v []lysand.Field) *UserUpsertOne {
func (u *UserUpsertOne) SetFields(v []versia.UserField) *UserUpsertOne {
return u.Update(func(s *UserUpsert) {
s.SetFields(v)
})
@ -1648,7 +1648,7 @@ func (u *UserUpsertBulk) UpdateURI() *UserUpsertBulk {
}
// SetExtensions sets the "extensions" field.
func (u *UserUpsertBulk) SetExtensions(v lysand.Extensions) *UserUpsertBulk {
func (u *UserUpsertBulk) SetExtensions(v versia.Extensions) *UserUpsertBulk {
return u.Update(func(s *UserUpsert) {
s.SetExtensions(v)
})
@ -1844,7 +1844,7 @@ func (u *UserUpsertBulk) UpdatePrivacyLevel() *UserUpsertBulk {
}
// SetFields sets the "fields" field.
func (u *UserUpsertBulk) SetFields(v []lysand.Field) *UserUpsertBulk {
func (u *UserUpsertBulk) SetFields(v []versia.UserField) *UserUpsertBulk {
return u.Update(func(s *UserUpsert) {
s.SetFields(v)
})

View file

@ -18,7 +18,7 @@ import (
"github.com/lysand-org/versia-go/ent/note"
"github.com/lysand-org/versia-go/ent/predicate"
"github.com/lysand-org/versia-go/ent/user"
"github.com/lysand-org/versia-go/pkg/lysand"
"github.com/lysand-org/versia-go/pkg/versia"
)
// UserUpdate is the builder for updating User entities.
@ -63,8 +63,8 @@ func (uu *UserUpdate) SetNillableURI(s *string) *UserUpdate {
}
// SetExtensions sets the "extensions" field.
func (uu *UserUpdate) SetExtensions(l lysand.Extensions) *UserUpdate {
uu.mutation.SetExtensions(l)
func (uu *UserUpdate) SetExtensions(v versia.Extensions) *UserUpdate {
uu.mutation.SetExtensions(v)
return uu
}
@ -215,14 +215,14 @@ func (uu *UserUpdate) SetNillablePrivacyLevel(ul *user.PrivacyLevel) *UserUpdate
}
// SetFields sets the "fields" field.
func (uu *UserUpdate) SetFields(l []lysand.Field) *UserUpdate {
uu.mutation.SetFields(l)
func (uu *UserUpdate) SetFields(vf []versia.UserField) *UserUpdate {
uu.mutation.SetFields(vf)
return uu
}
// AppendFields appends l to the "fields" field.
func (uu *UserUpdate) AppendFields(l []lysand.Field) *UserUpdate {
uu.mutation.AppendFields(l)
// AppendFields appends vf to the "fields" field.
func (uu *UserUpdate) AppendFields(vf []versia.UserField) *UserUpdate {
uu.mutation.AppendFields(vf)
return uu
}
@ -1038,8 +1038,8 @@ func (uuo *UserUpdateOne) SetNillableURI(s *string) *UserUpdateOne {
}
// SetExtensions sets the "extensions" field.
func (uuo *UserUpdateOne) SetExtensions(l lysand.Extensions) *UserUpdateOne {
uuo.mutation.SetExtensions(l)
func (uuo *UserUpdateOne) SetExtensions(v versia.Extensions) *UserUpdateOne {
uuo.mutation.SetExtensions(v)
return uuo
}
@ -1190,14 +1190,14 @@ func (uuo *UserUpdateOne) SetNillablePrivacyLevel(ul *user.PrivacyLevel) *UserUp
}
// SetFields sets the "fields" field.
func (uuo *UserUpdateOne) SetFields(l []lysand.Field) *UserUpdateOne {
uuo.mutation.SetFields(l)
func (uuo *UserUpdateOne) SetFields(vf []versia.UserField) *UserUpdateOne {
uuo.mutation.SetFields(vf)
return uuo
}
// AppendFields appends l to the "fields" field.
func (uuo *UserUpdateOne) AppendFields(l []lysand.Field) *UserUpdateOne {
uuo.mutation.AppendFields(l)
// AppendFields appends vf to the "fields" field.
func (uuo *UserUpdateOne) AppendFields(vf []versia.UserField) *UserUpdateOne {
uuo.mutation.AppendFields(vf)
return uuo
}