Skip to content

Commit

Permalink
add initial draft for encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
lovetodream committed Sep 20, 2024
1 parent a838957 commit 14b30f5
Show file tree
Hide file tree
Showing 7 changed files with 1,037 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Sources/OracleNIO/Constants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,10 @@ enum Constants {
static let TNS_JSON_FLAG_HASH_ID_UINT16: UInt16 = 0x0200
static let TNS_JSON_FLAG_NUM_FNAMES_UINT16: UInt16 = 0x0400
static let TNS_JSON_FLAG_FNAMES_SEG_UINT32: UInt16 = 0x0800
static let TNS_JSON_FLAG_TINY_NODES_STAT = 0x2000
static let TNS_JSON_FLAG_TINY_NODES_STAT: UInt16 = 0x2000
static let TNS_JSON_FLAG_TREE_SEG_UINT32: UInt16 = 0x1000
static let TNS_JSON_FLAG_REL_OFFSET_MODE: UInt16 = 0x01
static let TNS_JSON_FLAG_INLINE_LEAF = 0x02
static let TNS_JSON_FLAG_INLINE_LEAF: UInt16 = 0x02
static let TNS_JSON_FLAG_LEN_IN_PCODE = 0x04
static let TNS_JSON_FLAG_NUM_FNAMES_UINT32: UInt16 = 0x08
static let TNS_JSON_FLAG_IS_SCALAR: UInt16 = 0x10
Expand Down
6 changes: 6 additions & 0 deletions Sources/OracleNIO/Data/JSON/OracleJSON+Decoding.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ import NIOCore

import struct Foundation.Date

extension OracleJSON: Decodable where Value: Decodable {
public init(from decoder: any Decoder) throws {
self.value = try .init(from: decoder)
}

Check warning on line 22 in Sources/OracleNIO/Data/JSON/OracleJSON+Decoding.swift

View check run for this annotation

Codecov / codecov/patch

Sources/OracleNIO/Data/JSON/OracleJSON+Decoding.swift#L20-L22

Added lines #L20 - L22 were not covered by tests
}

extension OracleJSON: OracleDecodable where Value: Decodable {
public init(
from buffer: inout ByteBuffer,
Expand Down
Loading

0 comments on commit 14b30f5

Please sign in to comment.