Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F33103384
binary_value.ex
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
608 B
Referenced Files
None
Subscribers
None
binary_value.ex
View Options
# Pleroma: A lightweight social networking server
# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule
Pleroma.EctoType.Config.BinaryValue
do
use
Ecto.Type
def
type
,
do
:
:term
def
cast
(
value
)
when
is_binary
(
value
)
do
if
String
.
valid?
(
value
)
do
{
:ok
,
value
}
else
{
:ok
,
:erlang
.
binary_to_term
(
value
)}
end
end
def
cast
(
value
),
do
:
{
:ok
,
value
}
def
load
(
value
)
when
is_binary
(
value
)
do
{
:ok
,
:erlang
.
binary_to_term
(
value
)}
end
def
dump
(
value
)
do
{
:ok
,
:erlang
.
term_to_binary
(
value
)}
end
end
File Metadata
Details
Attached
Mime Type
text/x-ruby
Expires
Tue, Jan 20, 1:44 PM (1 d, 2 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
972277
Default Alt Text
binary_value.ex (608 B)
Attached To
Mode
rPUBE pleroma-upstream
Attached
Detach File
Event Timeline
Log In to Comment