question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

feat: Add a new `readonly` property to Model fields definition

See original GitHub issue

readonly will be a boolean property by default set to false.

Its operation can be something like:

  • when an instance is created or updated, if the field haven’t a value yet, then can be set without triggering a readonly error.
  • once the field has a value, any further modification attempt will trigger a readonly error.

This come in handy when manipulating this kind of fields, which is a common use case I think (I’ve the need of this kind of model fields across several different projects).

So, what do you think?

Issue Analytics

  • State:open
  • Created 8 years ago
  • Reactions:11
  • Comments:24 (12 by maintainers)

github_iconTop GitHub Comments

34reactions
reinertcommented, May 19, 2017

This definetly should be in core. ReadOnly option is a must have for ORMs.

13reactions
leodutracommented, Nov 22, 2017

Please consider it as core feature, gentlemen.

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - How to implement a read only property - Stack Overflow
readonly class fields are often used for variables that are initialized during class construction, and will never be changed later on. In short ......
Read more >
readonly keyword - C# Reference - Microsoft Learn
The readonly keyword is a modifier that can be used in four contexts: In a field declaration, readonly indicates that assignment to the...
Read more >
Mapping Table Columns - SQLAlchemy 1.4 Documentation
Mapping Table Columns¶. Introductory background on mapping to columns falls under the subject of Table configuration; the general form falls ...
Read more >
Declare and Initialize Read-only Auto Properties in C# ...
When you define fields, you should make sure you define them as private as this ensures you are not violating the concept of...
Read more >
What's New in PHP 8.1? Features, Changes, Improvements ...
Pure Intersection Types; Enums; The never Return Type; Fibers; New readonly Properties; Define final Class Constants; New fsync() and ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found