Skip to main content

Crate roomrs

Crate roomrs 

Source
Expand description

§roomrs

Room-style local SQLite persistence library for Rust.

This is the facade crate: it re-exports the public API from the internal crates. See the repository README for the full design document.

Re-exports§

pub use roomrs_core::rusqlite;

Macros§

migrations_dir
migrations_dir!("migrations") — 디렉터리의 {from}_{to}_이름.sql 파일들을 컴파일 타임에 임베드해 Vec<Migration> 으로 전개 (명세 §8.2).
params
A macro making it more convenient to pass longer lists of parameters as a &[&dyn ToSql].

Structs§

AsyncHandle
Async handle returned by db.run_async().
Col
컬럼 참조 — 비교 콤비네이터의 시작점
ColumnMeta
컬럼 메타 — #[entity] 생성, 스냅샷 대조·생성에 사용 (명세 §7)
ColumnSnapshot
컬럼 스냅샷
Database
roomrs 코어 데이터베이스 — 사용자는 #[database] 생성 타입으로 감싸 쓴다
DatabaseBuilder
빌더 (명세 §5.4)
DiffPlan
Structured migration plan between two snapshots (spec §8.1/§8.4).
EmbeddedSchema
Compile-time embedded schema snapshot (spec §8.4, decision 21c).
InvalidationFilter
Row-level invalidation condition for a live query.
InvalidationFilterBuilder
Builder for InvalidationFilter.
InvalidationGroupBuilder
Builder for an AND predicate group.
LiveQuery
라이브 쿼리 — 단일 구체 타입 (명세 §5.6). 의존 테이블 write 시 자동 재조회 emit. drop = 구독 해제. recv/recv_timeout은 호출 스레드를 블로킹한다. async에서는 into_stream을 쓴다. 마지막 DB 핸들 drop은 notifier 스레드 종료까지 join할 수 있다.
Migration
마이그레이션 스텝 — 세 소스(SQL 파일/인라인 SQL/코드)의 공통 표현 (명세 §8.2)
Query
쿼리 빌더 진입점 (명세 §5.3)
SchemaDef
테이블 스키마 정의 — #[database] 매크로가 엔티티 메타에서 구성
SchemaSnapshot
스키마 스냅샷 — 리포에 커밋되는 검증 진실 소스 (명세 §7.1)
SelectBuilder
SELECT 빌더 — 조건·정렬·페이지 조합
SubscriptionGuard
콜백 구독 가드 — drop = 해지
SyncHandle
동기 핸들 — db.run_sync() 반환 타입 (명세 §5.0). 모든 작업은 read/write 통합 풀에서 커넥션을 체크아웃한다.
TableMeta
테이블 메타 — #[database]가 엔티티에서 수집
TableSnapshot
테이블 스냅샷
Tx
A synchronous transaction bound to its checked-out connection and thread.

Enums§

Error
roomrs 단일 에러 타입 — 공개 API는 전부 이 타입으로 반환한다
Expr
WHERE 식 트리
MigrationPolicy
마이그레이션 정책 (명세 §8 — M1은 Auto 최소 동작만, M3에서 완성)
Order
정렬 방향
ToSqlOutput
ToSqlOutput represents the possible output types for implementers of the ToSql trait.

Constants§

SCHEMA_DIR_RELATIVE
Standard snapshot directory relative to the crate manifest (spec §7.2).

Traits§

BuildAsyncExt
Asynchronous build extensions for DatabaseBuilder.
DatabaseSpec
#[database] 생성물이 구현하는 스펙 trait — core 빌더가 타입드 DB를 돌려줄 수 있게 한다
Entity
테이블 매핑 메타. #[entity] 생성물.
Execute
핸들 대칭 실행자 (명세 §5.3 [C-6]) — 동기 = Result<R>, 비동기 = Boxed Future. #[database] 생성 핸들 래퍼에도 구현된다.
FromRow
쿼리 결과 한 행을 값으로 변환하는 trait. 엔티티는 #[entity] 매크로가 구현을 생성하고, 프리미티브·튜플은 아래 매크로로 일괄 구현한다.
Insertable
INSERT 지원 메타. #[entity] 생성물 (명세 §12c — autoincrement PK 항상 생략).
IntoDbValue
빌더 값 변환 — &str 포함 흔한 타입 열거 (코히어런스 안전)
MigrationStep
수동 코드 스텝 trait — (from,to) 쌍 모델 [C-3] (명세 §8.3)
Params
Trait used for sets of parameter passed into SQL statements/queries.
RelationView
관계 뷰 — 부모 엔티티 + 자식 컬렉션 조립 (Room @Embedded+@Relation 대응). #[derive(Relation)]이 구현을 생성한다.
SqlContext
DAO 공용 실행 컨텍스트 (명세 §5.9) — 풀-바운드(SyncHandle: 호출마다 통합 풀 체크아웃)와 tx-바운드(Tx: 트랜잭션 커넥션 고정)를 하나의 trait로 통일한다.
ToSql
A trait for types that can be converted into SQLite values. Returns crate::Error::ToSqlConversionFailure if the conversion fails.
WatchContext
DAO watch 컨텍스트 (명세 §5.6) — 풀-바운드 전용. Tx 구현은 “트랜잭션에서 라이브 불가” 에러를 첫 emit으로 전달한다.

Functions§

check_schema_snapshot
스냅샷 ↔ 엔티티 메타 일치 검사 — CI/check용 (명세 §7.4a)
col
컬럼 참조 시작점
compress_snapshot
Compress snapshot JSON bytes with miniz_oxide (raw deflate, level 8).
decompress_snapshot
Decompress bytes produced by compress_snapshot.
diff_plan
Compute a structured diff plan from old to new (spec §8.1, §8.4).
diff_sql
자동 diff 초안 SQL 생성 (명세 §8.1) — 절대 자동 실행하지 않는다(비목표). diff_plan 위에 렌더: 안전 연산은 실행문, 파괴적 항목은 -- TODO(파괴적) 주석, 경고는 -- 경고 주석으로 출력한다.
export_schema_for_test
Snapshot export/stale-check helper called by the test that #[database] generates (spec §7.4, decisions 21b/28).
list_snapshot_versions
List every {db_name}.{N}.json snapshot in dir, sorted ascending by version. N is parsed strictly (digits only, no leading zeros), so duplicate versions are impossible by file name. A missing directory yields an empty list.
outputs_to_values
ToSqlOutput 목록을 소유 Value 목록으로 변환
params_from_iter
Constructor function for a ParamsFromIter. See its documentation for more.
resolve_schema_dir
Resolve the snapshot directory: the ROOMRS_SCHEMA_DIR environment variable wins when set and non-empty, otherwise {manifest_dir}/migrations/schema (spec §7.2, decision 21).
snapshot_file_name
File name of a versioned snapshot: {db_name}.{version}.json (decision 21 — the current.json single-file model is gone).
snapshot_path
Full path of a versioned snapshot inside a schema directory.
to_owned_value
ToSql 값을 소유 Value로 변환 — 비동기 경로의 ’static 확보용 (명세 §2.4)
write_schema_snapshot
스냅샷 파일 생성/갱신 — 개발 플로우용 (명세 §7.4a). 경로: resolve_schema_dir(manifest_dir)/{DB_NAME}.{VERSION}.json

Type Aliases§

Result
roomrs 공용 Result 별칭

Attribute Macros§

dao
#[dao] — trait DSL을 소비해 동기 DAO 구현을 생성 (명세 §5.2). 메서드 속성: #[query("…")] · #[insert(on_conflict/keep_pk)] · #[update("…")] · #[delete("…")]
database
#[database(entities(…), daos(…), version = N)] — DB 진입점 생성 (명세 §5.4)
entity
#[entity(table = "…")] — 구조체를 테이블에 매핑 (명세 §5.1). 필드 속성: #[pk(autoincrement)] · #[column(name/unique/index/default/ignore)] · #[json]

Derive Macros§

Relation
#[derive(Relation)] — 관계 뷰 조립 코드 생성 (명세 결정 로그 7)