Skip to content

Add metadata to options #17

Open
Open
@KirIgor

Description

@KirIgor

In some cases it would be useful to define metadata for options while initializing.

For example we can use SmartInitializer for describing relational database tables:

class Model
  include SmartCore::Initializer

  def self.column(...)
    option(...)
  end
end

class Author < Model
  column :id, Types::Integer, metadata: { primary_key: true }
  column :name, Types::String, metadata: { unique: true }
end

class Book < Model
  column :author, Types::Integer, metadata: { foreign_key: Author }
  column :title, Types::String
end

class CoveredBook < Book
  column :cover, Types::Base64Image
end

In that case some static metadata that can be inherited would be very useful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions